-
-
Notifications
You must be signed in to change notification settings - Fork 96
Add intervals for scheduled task #498
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
base: master
Are you sure you want to change the base?
Add intervals for scheduled task #498
Conversation
|
I saw that several tests failed on older versions of Pydantic and Python, so I pushed fixes. |
| from tests.utils import AsyncQueueBroker | ||
|
|
||
|
|
||
| @pytest.mark.anyio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I enabled anyio_mode = "auto" flag for pytest. So tests doesn't need to explicitly say that they are async with pytest.mark.anyio marker.
You can just remove it and tests should work as they were)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…er_intervals # Conflicts: # docs/guide/cli.md # taskiq/cli/scheduler/run.py # tests/cli/scheduler/test_task_delays.py
|
I have resolved the merge conflicts and fixed the failing tests. |
Hi!
Following up on PR #399, which I left unfinished half a year ago:
In this PR, I want to add intervals for scheduled tasks.
List of changes:
intervalfield toScheduledTask.SchedulerLoopclass—an abstraction over the scheduler loop.loop_intervalargument toSchedulerArgs.skip_first_runmechanism intoSchedulerLoop.run().teskiq.api.scheduler.run_scheduler_tasksfunction now usesSchedulerLoop.schedule_by_intervalmethod in theAsyncTaskiqDecoratedTaskandAsyncKickerclasses.The main idea is to iterate through all tasks every
loop_intervaland check if they need to be executed.Example:
Logs: