Closed rcholic closed 2 months ago
The command is incorrect. Because scheduler should be started with taskiq scheduler
command. Try this config:
taskiq-scheduler:
<<: *main_app
labels: []
command:
- taskiq
- scheduler
- -fsd
- market_insights.tkq:scheduler
taskiq-worker:
<<: *main_app
labels: []
command:
- taskiq
- worker
- -fsd
- market_insights.tkq:broker
taskiq-scheduler: <<: *main_app labels: [] command: - taskiq - scheduler - -fsd - market_insights.tkq:scheduler
Thanks for your answer, but my scheduler does not run with the updates made to my docker-compose.yaml file.
The heavy_task
does not get triggered:
@broker.task(schedule=[{"cron": "*/1 * * * *", "cron_offset": None, "time": None, "args": [10], "kwargs": {}, "labels": {}}])
async def heavy_task(a: int) -> int:
if broker.is_worker_process:
logger.info("heavy_task: {} is in worker process!!!", a)
else:
logger.info("heavy_task: {} NOT in worker process", a)
return 100 + a
@s3rius After many tries, my taskiq scheduler seems to be running:
taskiq-scheduler-1 | [2024-07-20 14:02:00,036][INFO ][run:run_scheduler:217] First run skipped. The scheduler is now running.
But the output of the task is not generated, so I was wondering how to verify the task is actually running. any suggestions? Thanks
I followed the documentation for Taskiq here to set up scheduler in my tkq.py file, like following:
And I created an example task:
In the docker-compose.yml file, I start the broker and scheduler like so:
However, the taskiq scheduler does not seem to do anything. I guess I must be missing something. Can some experts help? Thanks