-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reworked config to start from DL1 and add slurm options to better man…
…age jobs requirements
- Loading branch information
vuillaut
committed
Sep 6, 2024
1 parent
624590a
commit 27e640a
Showing
4 changed files
with
3,337 additions
and
3,049 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
39 changes: 39 additions & 0 deletions
39
production_configs/20240828_v0.10.9_GC_dec_min_2924_tuned/add_slurm_options.py
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,39 @@ | ||
import sys | ||
from ruamel.yaml import YAML | ||
|
||
|
||
def add_slurm_options(config_file): | ||
yaml = YAML() | ||
yaml.preserve_quotes = True | ||
config = yaml.load(open(config_file)) | ||
|
||
for stage_name, stage in config['stages'].items(): | ||
for ii, step in enumerate(stage): | ||
slurm_options = step.get('extra_slurm_options', {}) | ||
if 'time' not in slurm_options: | ||
if stage_name == 'r0_to_dl1': | ||
slurm_options['time'] = '10:00:00' | ||
elif stage_name == 'train_pipe': | ||
slurm_options['time'] = '02-00:00:00' | ||
elif stage_name == 'dl1ab': | ||
slurm_options['time'] = '04:00:00' | ||
elif stage_name == 'merge_dl1' and ('GammaDiffuse' in step['input'] or 'Protons' in step['input']): | ||
slurm_options['time'] = '08:00:00' | ||
else: | ||
slurm_options['partition'] = 'short' | ||
if 'nice' not in slurm_options: | ||
slurm_options['nice'] = 10 | ||
stage[ii]['extra_slurm_options'] = slurm_options | ||
|
||
with open(config_file, 'w') as f: | ||
yaml.dump(config, f) | ||
|
||
if __name__ == '__main__': | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description='Add Slurm options to each step in the given YML config file.') | ||
parser.add_argument('input', help='Path to the input YML config file') | ||
|
||
args = parser.parse_args() | ||
|
||
add_slurm_options(args.input) |
Oops, something went wrong.