@@ -38,7 +38,7 @@ class OarInfoWatcher(core.InfoWatcher):
3838 }
3939
4040 def _make_command (self ) -> tp .Optional [tp .List [str ]]:
41- to_check = { x for x in self ._registered - self ._finished }
41+ to_check = set ( self ._registered - self ._finished )
4242 if not to_check :
4343 return None
4444 command = ["oarstat" , "-f" , "-J" ]
@@ -88,7 +88,7 @@ def __init__(self, folder: tp.Union[Path, str], job_id: str, tasks: tp.Sequence[
8888 if len (tasks ) > 1 :
8989 raise NotImplementedError
9090 super ().__init__ (folder , job_id , tasks )
91- self ._resubmitted_job = None
91+ self ._resubmitted_job : tp . Optional [ OarJob [ core . R ]] = None
9292
9393 def _interrupt (self , timeout : bool = False ) -> None :
9494 """Sends preemption or timeout signal to the job (for testing purpose)
@@ -174,8 +174,6 @@ def _get_resubmitted_job(self) -> tp.Optional["OarJob[core.R]"]:
174174 folder = self ._paths .folder , job_id = resubmitted_job_id , tasks = [0 ]
175175 )
176176 return self ._resubmitted_job
177- else :
178- return None
179177 except Exception as e :
180178 logger .get_logger ().error (
181179 f"Getting error with _get_resubmitted_job() by command { command } :\n "
@@ -259,7 +257,7 @@ def _internal_update_parameters(self, **kwargs: tp.Any) -> None:
259257 Parameters
260258 ----------
261259 See oar documentation for most parameters.
262- Most useful parameters are: core , walltime, gpu, queue.
260+ Most useful parameters are: cores , walltime, gpu, queue.
263261
264262 Below are the parameters that differ from OAR documentation:
265263
@@ -326,7 +324,7 @@ def _internal_process_submissions(
326324 if any (isinstance (d .function , helpers .Checkpointable ) for d in delayed_submissions ) and any (
327325 not isinstance (d .function , helpers .Checkpointable ) for d in delayed_submissions
328326 ):
329- raise Exception (
327+ raise ValueError (
330328 "OarExecutor does not support a job array that mixes checkpointable and non-checkpointable functions."
331329 "\n Please make groups of similar function calls in the job array."
332330 )
@@ -434,7 +432,7 @@ def _make_oarsub_string(
434432 folder : tp .Union [str , Path ],
435433 map_count : tp .Optional [int ] = None , # used internally
436434 nodes : tp .Optional [int ] = None ,
437- core : tp .Optional [int ] = None ,
435+ cores : tp .Optional [int ] = None ,
438436 gpu : tp .Optional [int ] = None ,
439437 walltime : tp .Optional [str ] = None ,
440438 timeout_min : tp .Optional [int ] = None ,
@@ -449,7 +447,7 @@ def _make_oarsub_string(
449447 Parameters
450448 ----------
451449 See oar documentation for most parameters.
452- Most useful parameters are: core , walltime, gpu, queue.
450+ Most useful parameters are: cores , walltime, gpu, queue.
453451
454452 Below are the parameters that differ from OAR documentation:
455453
@@ -474,13 +472,13 @@ def _make_oarsub_string(
474472 # OAR resource hierarchy: nodes > gpu > core
475473 resource_hierarchy = ""
476474 if nodes is not None :
477- resource_hierarchy += "/nodes=%d" % nodes
475+ resource_hierarchy += f "/nodes={ nodes } "
478476 if gpu is not None :
479- resource_hierarchy += "/gpu=%d" % gpu
480- if core is not None :
481- resource_hierarchy += "/core=%d" % core
477+ resource_hierarchy += f "/gpu={ gpu } "
478+ if cores is not None :
479+ resource_hierarchy += f "/core={ cores } "
482480 if walltime is not None :
483- walltime = "walltime=%s" % walltime
481+ walltime = f "walltime={ walltime } "
484482 resource_request = "," .join (filter (None , (resource_hierarchy , walltime )))
485483 if resource_request :
486484 parameters ["l" ] = resource_request
0 commit comments