File tree Expand file tree Collapse file tree 5 files changed +11
-9
lines changed
Expand file tree Collapse file tree 5 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ def submit_mbar_slurm(
234234 if wait :
235235 for job in jobs :
236236 while job in virtual_queue .queue :
237- _sleep (30 )
237+ _sleep (slurm_config . job_submission_wait )
238238 virtual_queue .update ()
239239
240240 return jobs , mbar_out_files , tmp_files
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ class SlurmConfig(_BaseModel):
3333 extra_options : _Dict [str , str ] = _Field (
3434 {}, description = "Extra options to pass to SLURM. For example, {'account': 'qt'}"
3535 )
36+ queue_check_interval : int = _Field (30 , ge = 1 , description = "Interval in seconds between SLURM queue status checks." )
37+ job_submission_wait : int = _Field (300 , ge = 1 , description = "Wait time in seconds for job submission to SLURM queue." )
3638
3739 model_config = _ConfigDict (validate_assignment = True )
3840
Original file line number Diff line number Diff line change @@ -667,9 +667,9 @@ def running(self) -> bool:
667667 def wait (self ) -> None :
668668 f"""Wait for the { self .__class__ .__name__ } to finish running."""
669669 # Give the simulation runner a chance to start
670- _sleep (30 )
670+ _sleep (self . slurm_config . queue_check_interval )
671671 while self .running :
672- _sleep (30 ) # Check every 30 seconds
672+ _sleep (self . slurm_config . queue_check_interval ) # Check every 30 seconds
673673
674674 def get_tot_simtime (self , run_nos : _Optional [_List [int ]] = None ) -> float :
675675 f"""
Original file line number Diff line number Diff line change @@ -788,14 +788,14 @@ def _run_slurm(
788788 self ._logger .info (
789789 f"Waiting for job { job } to be submitted to the real slurm queue"
790790 )
791- _sleep (5 * 60 )
791+ _sleep (self . slurm_config . job_submission_wait )
792792 self .virtual_queue .update ()
793793
794794 # Wait for the job to complete if we've specified wait
795795 if wait :
796796 while job in self .virtual_queue .queue :
797797 self ._logger .info (f"Waiting for job { job } to complete" )
798- _sleep (30 )
798+ _sleep (self . slurm_config . queue_check_interval )
799799 self .virtual_queue .update ()
800800
801801 def run (
Original file line number Diff line number Diff line change @@ -1158,19 +1158,19 @@ def wait(self) -> None:
11581158 # Override the base class method so that we can update the
11591159 # virtual queue
11601160 # Give the simulations a chance to start
1161- _sleep (30 )
1161+ _sleep (self . slurm_config . queue_check_interval )
11621162 self .virtual_queue .update ()
11631163 while self .running :
1164- _sleep (30 ) # Check every 30 seconds
1164+ _sleep (self . slurm_config . queue_check_interval ) # Check every 30 seconds
11651165 self .virtual_queue .update ()
11661166
11671167 def _wait_ignoring_thread (self ) -> None :
11681168 """Wait for the stage to finish running, ignoring the thread."""
1169- _sleep (30 )
1169+ _sleep (self . slurm_config . queue_check_interval )
11701170 self .virtual_queue .update ()
11711171 # Superclass implementation of running ignores the thread
11721172 while super ().running :
1173- _sleep (30 )
1173+ _sleep (self . slurm_config . queue_check_interval )
11741174 self .virtual_queue .update ()
11751175
11761176 @property
You can’t perform that action at this time.
0 commit comments