Skip to content
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

Add one-off jobs for report scheduler #4045

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jpbruinsslot
Copy link
Contributor

@jpbruinsslot jpbruinsslot commented Jan 23, 2025

Changes

Current situation:

  • When a report schedule was created for a certain time in the future, as a manual one-off execution. It wasn't possible to reschedule that same job for a new time.
  • That had to do with the scheduler checking if there was the same task already being executed in the past. And wouldn't perform a new task when it was found.

New situation:

  • This pr adds support for the following Schedule scenario's:
    1. Has a cron expression, a predefined recurring schedule for when a task should be added to the queue.
    2. No cron expression, but with auto_calculate_deadline. In this case, the Scheduler type has the ability to calculate a date when the task should be added back to the queue.
    3. No cron expression and no auto_calculate_deadline. These are one-off tasks that need to be executed at a specific date.

This to make sure to enable the following functionality:

  1. one-off task set at a specific date
  2. recurring tasks, next date determined by a scheduler type (e.g. BoefjeScheduler calculates the next date based on prior results)
  3. recurring tasks, next date determined by a cron expression

Issue link

No issue

QA notes

In combination with pr TODO: add rocky pr test if you're able to schedule a one-off report job, and reschedule it at a later date


Code Checklist

  • All the commits in this PR are properly PGP-signed and verified.
  • This PR only contains functionality relevant to the issue.
  • I have written unit tests for the changes or fixes I made.
  • I have checked the documentation and made changes where necessary.
  • I have performed a self-review of my code and refactored it to the best of my abilities.
  • Tickets have been created for newly discovered issues.
  • For any non-trivial functionality, I have added integration and/or end-to-end tests.
  • I have informed others of any required .env changes files if required and changed the .env-dist accordingly.
  • I have included comments in the code to elaborate on what is not self-evident from the code itself, including references to issues and discussions online, or implicit behavior of an interface.

Checklist for code reviewers:

Copy-paste the checklist from the docs/source/templates folder into your comment.


Checklist for QA:

Copy-paste the checklist from the docs/source/templates folder into your comment.

@jpbruinsslot jpbruinsslot requested a review from a team as a code owner January 23, 2025 11:53
@Rieven
Copy link
Contributor

Rieven commented Jan 23, 2025

I've tested this branch in our upcoming branch for reuse report oois and got some errors on that deadline_at = None with validation errors for datetime object as None. The once schedules can have a deadline_at in the future. I think for reruns with once schedule should edit the schedule deadline_at to now. that would suffice. Can we not use the API endpoint to edit the schedule deadline_at?

Also we can only edit the deadline_at to now when the schedule has a deadline_at older than now

@jpbruinsslot jpbruinsslot self-assigned this Jan 27, 2025
@jpbruinsslot jpbruinsslot added the mula Issues related to the scheduler label Jan 27, 2025
@jpbruinsslot
Copy link
Contributor Author

I've tested this branch in our upcoming branch for reuse report oois and got some errors on that deadline_at = None with validation errors for datetime object as None. The once schedules can have a deadline_at in the future. I think for reruns with once schedule should edit the schedule deadline_at to now. that would suffice. Can we not use the API endpoint to edit the schedule deadline_at?

Also we can only edit the deadline_at to now when the schedule has a deadline_at older than now

I personal correspondence I mentioned that the model definition in rocky for a Schedule had to change to support the None value for a deadline_at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mula Issues related to the scheduler
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

2 participants