File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed
tests/v2/test_08_backends Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -126,4 +126,4 @@ class JobRunnerConfigSLURM(BaseModel):
126126 default_slurm_config : _SlurmConfigSet
127127 gpu_slurm_config : _SlurmConfigSet | None = None
128128 batching_config : _BatchingConfigSet
129- user_local_exports : DictStrStr | None = None
129+ user_local_exports : DictStrStr = Field ( default_factory = dict )
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ def _get_slurm_config_internal(
7777 else :
7878 needs_gpu = False
7979 logger .debug (f"[get_slurm_config] { needs_gpu = } " )
80- if needs_gpu :
80+ if needs_gpu and shared_config . gpu_slurm_config is not None :
8181 for key , value in shared_config .gpu_slurm_config .model_dump (
8282 exclude_unset = True , exclude = {"mem" }
8383 ).items ():
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ class SlurmConfig(BaseModel):
8686 extra_lines : list [str ] = Field (default_factory = list )
8787
8888 # Variables that will be `export`ed in the SLURM submission script
89- user_local_exports : dict [str , str ] | None = None
89+ user_local_exports : dict [str , str ] = Field ( default = dict )
9090
9191 # Metaparameters needed to combine multiple tasks in each SLURM job
9292 tasks_per_job : int | None = None
@@ -189,14 +189,13 @@ def to_sbatch_preamble(
189189 for line in self ._sorted_extra_lines ():
190190 lines .append (line )
191191
192- if self .user_local_exports :
193- if remote_export_dir is None :
194- raise ValueError (
195- f"remote_export_dir=None but { self .user_local_exports = } "
196- )
197- for key , value in self .user_local_exports .items ():
198- tmp_value = str (Path (remote_export_dir ) / value )
199- lines .append (f"export { key } ={ tmp_value } " )
192+ if self .user_local_exports != {} and remote_export_dir is None :
193+ raise ValueError (
194+ f"{ remote_export_dir = } but { self .user_local_exports = } "
195+ )
196+ for key , value in self .user_local_exports .items ():
197+ tmp_value = str (Path (remote_export_dir ) / value )
198+ lines .append (f"export { key } ={ tmp_value } " )
200199
201200 """
202201 FIXME export SRUN_CPUS_PER_TASK
Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ def test_get_slurm_config_internal_gpu_options():
138138 "max_num_jobs" : 10 ,
139139 },
140140 )
141+ assert shared_slurm_config .user_local_exports == {}
141142 assert shared_slurm_config .default_slurm_config .extra_lines == []
142143
143144 # In absence of `needs_gpu`, parameters in `gpu_slurm_config` are not used
You can’t perform that action at this time.
0 commit comments