File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -97,18 +97,13 @@ easy_slurm.submit_job(
97
97
98
98
The job names can be formatted using a config dictionary:
99
99
``` python
100
- job_name = easy_slurm.format.format_with_config(
101
- " bs={hp.batch_size:04 } ,lr={hp.lr:.1e } " ,
102
- config = {" hp" : {" batch_size" : 32 , " lr" : 1e-2 }},
103
- )
104
-
105
100
easy_slurm.submit_job(
106
- job_dir = " $HOME/jobs/{date: %Y-%m-%d} -{job_name} " ,
107
101
sbatch_options = {
108
- " job-name" : job_name, # equals "bs=0032,lr=1.0e-02"
109
- ...
102
+ " job-name" : " bs={hp.batch_size:04 } ,lr={hp.lr:.1e } " ,
103
+ # Equivalent to:
104
+ # "job-name": "bs=0032,lr=1.0e-02"
110
105
},
111
- ...
106
+ config = { " hp " : { " batch_size " : 32 , " lr " : 1e-2 }},
112
107
)
113
108
```
114
109
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ def submit_job(
37
37
submit : bool = True ,
38
38
interactive : bool = False ,
39
39
resubmit_limit : int = 64 ,
40
+ config : dict [str , Any ] = {},
40
41
) -> str :
41
42
"""Submits job.
42
43
@@ -87,12 +88,17 @@ def submit_job(
87
88
Maximum number of times to auto-submit a job for "resume".
88
89
(Not entirely unlike submitting a resume for a job.)
89
90
Default is 64 resubmissions.
91
+ config (dict[str, Any]):
92
+ A dictionary of configuration values to use for formatting.
90
93
91
94
Returns:
92
95
Path to the newly created job directory.
93
96
"""
94
97
job_name = sbatch_options .get ("job-name" , "untitled" )
95
- job_dir = _expand_path (format_with_config (job_dir , {"job_name" : job_name }))
98
+ job_name = format_with_config (job_name , config )
99
+ job_dir = _expand_path (
100
+ format_with_config (job_dir , {** config , "job_name" : job_name })
101
+ )
96
102
create_job_dir (job_dir , src )
97
103
98
104
_write_script (
You can’t perform that action at this time.
0 commit comments