-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix job resume on non-preemption type failures (#803)
* simplest way to fix resume on node failure * lint * add slurm util [y * add slurm.py * fix typo * add print * only modify pickle on master * fix comment * use submit to get pickle path * str paths * typo * typo * timestamp_id was already in cmd
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from __future__ import annotations | ||
|
||
import logging | ||
import pickle | ||
|
||
from submitit.core.utils import JobPaths | ||
|
||
|
||
def add_timestamp_id_to_submission_pickle(slurm_folder: str, slurm_job_id: str, timestamp_id: str): | ||
# Try to put the timestamp-id into the original submission pickle's config | ||
# so that if the node crashes, it can be pick up the correct run to resume | ||
# | ||
# we need to do this after the job has started because the timestamp-id is generated at runtime | ||
# instead a-priori before the submission starts (ie: if we had a db to store a global job unique job) | ||
submission_pickle_path = JobPaths(folder=slurm_folder, job_id=slurm_job_id).submitted_pickle | ||
try: | ||
with open(str(submission_pickle_path), "rb") as f: | ||
pkl = pickle.load(f) | ||
# args passed to the runner function (0 is the input_dict): https://github.com/FAIR-Chem/fairchem/blob/main/src/fairchem/core/_cli.py#L36 | ||
pkl.args[0]["timestamp_id"] = timestamp_id | ||
with open(str(submission_pickle_path), "wb") as f: | ||
pickle.dump(pkl, f) | ||
except Exception as e: | ||
# Since this only affects the ability to resume jobs, if the pickle doesn't exist | ||
# or the format changed, throw a warning instead of failing the job here | ||
logging.warn(f"Couldn't modify the submission pickle with error: {e}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters