-
Notifications
You must be signed in to change notification settings - Fork 512
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
[Core] Avoid job scheduling race condition #4310
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for identifying this @Michaelvll ! LGTM
Actually, do you think we should add job specific lock for all job-related actions? |
Do you have any examples where we should add the lock? |
e.g. in this function we are getting all information of the jobs altogether, and cancel them one-by-one. Not sure if it is possible that some job information is stale, but adding lock to every place looks safer to me skypilot/sky/skylet/job_lib.py Lines 749 to 762 in 42c79e1
This is the only one I can find, but not sure if I missed any place |
Ahh, good catch! I fixed that in #4318, but did not adopt it in this one. Let me do it now. |
Thanks! LGTM. |
Another race condition in job scheduling besides #4264 ...
The pending jobs should be queried during the pending loop, otherwise, a same job can be submitted twice to ray job in the following condition.
schedule_step()
and both get the list of pending jobs23 jobs in parallel now, a bit more than #4264
Tested (run the relevant ones):
bash format.sh
pytest tests/test_smoke.py
pytest tests/test_smoke.py::test_fill_in_the_name
conda deactivate; bash -i tests/backward_compatibility_tests.sh