Open lukemaxwell opened 6 years ago
I ran across this issue as well even when passing -m mymodule
to tasktiger. I finally figured out a solution that works. I use click
for cli commands, and made one to fire off a worker:
@tasks.command("worker")
def start_worker():
secho(f"Starting worker", fg="green")
from mymodule.tasks import process_events, process_other_events, process_events_for_specific_email # register the tasks
tiger.run_worker(module='mymodule')
sys.exit(0)
Hope this helps!
yeah , i meet same question
I seem to have the same problem as well. Any updates on this? I'm happy to look into it if nobody else is.
Does the example in the op work for you if you run tasktiger like this so it processes the periodic
queue?
PYTHONPATH=. tasktiger -q periodic
Actually @jkemp101 , I think I see what the problem is based on the comments in the test:
My issue was that I was creating a fresh TaskTiger
instance when running the worker instead of using the same one where the periodic task was defined. When I import the same instance that I used when defining the tasks, things work as expected. If somebody else on this issue can confirm that this fixes the issue for them, I will issue a PR for docs updates.
@mrname I was also creating a fresh TaskTiger instance. I confirm this fixes the issue with periodic tasks not being scheduled
I can't seem to get the periodic tasks to execute, or show up in the 'scheduled' queue.
Using the following tasks.py for debug:
Running tasktiger as shown in docs:
I can run the minimal test_task:
I see the output in the log, but there is no evidence of the periodic_task and the redis key 'period_count' never increments:
Am I missing something?
By the way, TaskTiger is a great project!