-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why work only with tty: true? #31
Comments
Can you share the logs of container when you run without tty? |
@Foldren for that to happen, all your trigger conditions should no longer ever satisfy. For example having loop_count=1 ensures all tasks are executed only once. If all tasks are executed, then aioclock quit as mentioned. There is 2 possible scenarios:
i can improve logging a bit to make this more clear, |
On start in lifespan i get message, but it's doesn't work without tty |
Can you provide a snippet code that reproduce the issue? @Foldren |
from asyncio import run
from contextlib import asynccontextmanager
from aioclock import AioClock, At, Every, Once
from tortoise import Tortoise
from config import TORTOISE_CONFIG, APP_NAME
from modules.logger import Logger
from modules.playwright.maybank import Maybank
@asynccontextmanager
async def lifespan(_: AioClock):
await Tortoise.init(TORTOISE_CONFIG)
await Tortoise.generate_schemas(safe=True)
await Logger(APP_NAME).success(msg="Started.", func_name="startup")
yield _
app = AioClock(lifespan=lifespan)
@app.task(trigger=At(tz="Europe/Moscow", hour=3, minute=5))
async def load_stats():
await Maybank().load_stats()
if __name__ == '__main__':
run(app.serve()) |
by the way, it would be cool to add your own logger to aioclock |
@Foldren I don't understand what do you mean by own logger, we're using python stdlib logger which is highly configurable and should be compatible with any other logging libraries. P.S: you can run this code few time to understand what I mean :) import asyncio
import random
from contextlib import asynccontextmanager
from aioclock import AioClock, Once
@asynccontextmanager
async def lifespan(app: AioClock):
print("Hey")
if random.choice([True, False]):
raise Exception("lifespan")
yield app
print("Bye")
app = AioClock(lifespan=lifespan)
@app.task(trigger=Once())
async def foo():
print("foo")
if __name__ == "__main__":
asyncio.run(app.serve()) |
Closing due to inactivity. |
Can you try launch this in docker and send container log? |
Well, the problem has not been solved |
I tried to start the application aioclock in the docker container but it doesn't start without
tty: true
The text was updated successfully, but these errors were encountered: