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

Catching create job failures, updates to job definition #253

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

3coins
Copy link
Collaborator

@3coins 3coins commented Nov 1, 2022

  • Current task runner will end the async loop if any exceptions are raised by the scheduler while creating the job. Fixed this by catching any exceptions during create_job step.
  • Resuming job definition after pausing will not add the task to the queue in certain scenarios. Fixed this by ensuring that on job definition update, task is added to the queue if not present. To reproduce
    1. Create a scheduled job that runs every 2 mins, let the first job run.
    2. Pause the job definition
    3. Resume the job definition within the next 2 mins
    4. Job will not run at the end of 2 mins

@3coins 3coins added the bug Something isn't working label Nov 1, 2022
@3coins 3coins self-assigned this Nov 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2022

Binder 👈 Launch a Binder on branch 3coins/jupyter-scheduler/catch-exceptions

@3coins 3coins added this to the 1.0 Release milestone Nov 1, 2022
@3coins 3coins marked this pull request as ready for review November 1, 2022 22:07
@3coins 3coins requested a review from dlqqq November 1, 2022 22:13
@dlqqq
Copy link
Collaborator

dlqqq commented Nov 1, 2022

Ah I see the issue with the current logic. Let's say creates a job definition to run every minute, and suppose the following actions occur:

t action
0.0 job definition created
0.3 job definition paused => cache.next_run_time = 1
0.3 + poll_interval process_queue() executes, removes task from heap because active == False
0.7 job definition resume => next_run_time == 1 and next_run_time == cache.next_run_time => task is not added back into the heap

To fix this, I don't think we need to scan the entire heap when updating a job definition. Instead we just need to change the condition to:

new_next_run_time = cached_next_run_time != next_run_time and active
resumed = model.active and not cache.active

... # update cache

if (new_next_run_time or resumed):
  ... # add task to heap

@3coins 3coins removed this from the 1.0 Release milestone Nov 1, 2022
@3coins
Copy link
Collaborator Author

3coins commented Nov 2, 2022

@dlqqq Updated as per our discussion.

@3coins 3coins merged commit dbe2808 into jupyter-server:main Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants