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

Running one-off task stops all periodical tasks #150

Closed
putsi opened this issue Jun 27, 2018 · 7 comments
Closed

Running one-off task stops all periodical tasks #150

putsi opened this issue Jun 27, 2018 · 7 comments
Assignees

Comments

@putsi
Copy link

putsi commented Jun 27, 2018

I'm running the development version which is installed via pip and noticed an issue related to the new one-off feature.

If there are n amount of tasks that are run periodically (e.g. once a minute) and the user runs some other task with the one-off attribute, the periodical tasks are not run anymore after the one-off task stops.

Everything seems normal when inspected from the web interface (oneoff-task is disabled and the others are enabled) and from logs (scheduler keeps checking for tasks but doesn't simply notice/send the periodicals).
When the celery worker is restarted, the periodical tasks start running normally.

I tried to debug what is causing this but could not find any specific function.

@putsi putsi changed the title Running one-off task stops all other tasks Running one-off task stops all periodical tasks Jun 27, 2018
@hartwork
Copy link
Contributor

Which version of django-celery-beat is affected?

@vbabiy
Copy link
Contributor

vbabiy commented Jun 12, 2020

@putsi I have seen this as well. It is caused by

    def is_due(self, last_run_at):
        if not self.enabled:
            return schedstate(is_due=False, next=None)
        rem_delta = self.remaining_estimate(None)
        remaining_s = max(rem_delta.total_seconds(), 0)
        if remaining_s == 0:
            if self.model:
                self.model.enabled = False
                self.model.save()
            return schedstate(is_due=True, next=None)
        return schedstate(is_due=False, next=remaining_s)

Not handling one of task correctly, and disabling the clocked schedule but not the one of task. Once in the this state the task is never due and blocks all other tasks during the tick.

I think #341 will fix this.

@auvipy I am seeing this on 2.0.0

@auvipy
Copy link
Member

auvipy commented Jun 13, 2020

@putsi I have seen this as well. It is caused by

    def is_due(self, last_run_at):
        if not self.enabled:
            return schedstate(is_due=False, next=None)
        rem_delta = self.remaining_estimate(None)
        remaining_s = max(rem_delta.total_seconds(), 0)
        if remaining_s == 0:
            if self.model:
                self.model.enabled = False
                self.model.save()
            return schedstate(is_due=True, next=None)
        return schedstate(is_due=False, next=remaining_s)

Not handling one of task correctly, and disabling the clocked schedule but not the one of task. Once in the this state the task is never due and blocks all other tasks during the tick.

I think #341 will fix this.

@auvipy I am seeing this on 2.0.0

i request you to review that PR and change that in a nonbreakable way

@yywing
Copy link
Contributor

yywing commented Jun 29, 2020

schedstate(is_due=False, next=None) will make it stuck.

@auvipy auvipy self-assigned this Jul 1, 2020
@auvipy auvipy closed this as completed Dec 11, 2021
@hartwork
Copy link
Contributor

@auvipy did PR #341 fix this? Is that why you just closed the issue?

@auvipy
Copy link
Member

auvipy commented Dec 11, 2021

that should have. but if you hit with something like this, let us know

@hartwork
Copy link
Contributor

Alright, thanks for the clarification 🙏

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

No branches or pull requests

5 participants