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 schedule task func #22

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

Add schedule task func #22

wants to merge 59 commits into from

Conversation

j43333
Copy link
Collaborator

@j43333 j43333 commented Aug 23, 2024

No description provided.

j43333 and others added 30 commits August 20, 2024 11:50
@LeoTurnell-Ritson LeoTurnell-Ritson changed the base branch from feature/day-scheduler to main August 23, 2024 14:39
@LeoTurnell-Ritson LeoTurnell-Ritson changed the base branch from main to feature/day-scheduler August 23, 2024 14:39
@LeoTurnell-Ritson LeoTurnell-Ritson changed the base branch from feature/day-scheduler to main August 23, 2024 14:39
if task.interval_minutes:
add_task(task.execute, task.interval_minutes, next_run_time=soon if task.onstart else None)
else:
add_day_task(task.execute, task.day, task.hour, next_run_time=soon if task.onstart else None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a day task should run on start. I think the paradigm implies that it will only run at the specified day/time.

last_timestamp = models.DateTimeField(null=True, blank=True)
last_success = models.BooleanField(null=True, blank=True)
last_runtime = models.FloatField(null=True, blank=True)
day = models.CharField(max_length=3, null=True, blank=True) # Day of the week ('mon', 'tue', etc.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validators=[MinValueValidator(1), MaxValueValidator(1440)],
null=True,
blank=True
) # 1 min to 24 hours

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some validation that says you must either have day+hour OR interval_minutes?

Copy link
Contributor

@edmondac edmondac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with a few comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants