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

Paused jobs do not execute when resumed #856

Closed
1 task done
parisosuch-dev opened this issue Jan 24, 2024 · 3 comments
Closed
1 task done

Paused jobs do not execute when resumed #856

parisosuch-dev opened this issue Jan 24, 2024 · 3 comments

Comments

@parisosuch-dev
Copy link

Things to check first

  • I have searched the existing issues and didn't find my feature already requested there

Feature description

When a paused job is resumed and it was suppose to be executed while it was paused, it will not execute that job when the job is resumed. I believe this has to do with the next_run_time being removed and calculated on the resuming of the job. It would be great if this feature worked more like the entire scheduler being paused. When the scheduler itself is resumed, any scheduled jobs that would have been ran since pausing are executed on the resuming of the scheduler.

LMK if you want help with this feature.

Use case

I am working on a project that pauses certain groups of jobs based on the state of the system. I want those jobs to begin executing after they are resumed if they were suppose to be executed since the pausing of those jobs.

@xLinkOut
Copy link

xLinkOut commented Apr 5, 2024

Hello! I have a question regarding the issue you encountered: did you happen to start the scheduler with the paused=True parameter?

For example:

def job():
    print(datetime.now())

scheduler = BackgroundScheduler()
scheduler.add_job(job, 'interval', seconds=1, id="my_job")
scheduler.start(paused=True)

I ask this because I noticed that, in this case, the scheduler.resume_job("my_job") statement doesn't resume the job execution.

@parisosuch-dev
Copy link
Author

Sorry I am late to this response. I don't recall if there was an issue or not. I think it has to do with the ability to unpause jobs and execute them if their execute time has been eclipsed.

Sorry, I cannot help much past that. I no longer work for the company I was under when working on this project.

@agronholm
Copy link
Owner

Schedule pausing/unpausing has been implemented for v4.0 in #902. That should cover your use case.

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

3 participants