@@ -434,29 +434,31 @@ def filternodes(self, job, nodes):
434434
435435 return nodes
436436
437- def _get_reservation_nodes (self , reservation ):
438- completed = _run_strict ('scontrol -a show res %s' % reservation )
439- node_match = re .search (r'( Nodes=\S+)' , completed .stdout )
437+ def _get_reservation_nodes (self , resv ):
438+ completed = _run_strict (f 'scontrol -a show -o reservations { resv } ' )
439+ node_match = re .search (r'Nodes=( \S+)' , completed .stdout )
440440 if node_match :
441441 reservation_nodes = node_match [1 ]
442442 else :
443- raise JobSchedulerError (" could not extract the node names for "
444- " reservation '%s'" % reservation )
443+ raise JobSchedulerError (' could not extract the node names for '
444+ f' reservation { resv !r } ' )
445445
446446 flags_match = re .search (r'Flags=(\S+)' , completed .stdout )
447447 if flags_match :
448448 if 'MAINT' in flags_match .group (1 ).split (',' ):
449449 self .node_available_states .add ('MAINTENANCE' )
450450 else :
451- self .log (f" could not extract the reservation flags for "
452- f" reservation ' { reservation } '" )
451+ self .log (' could not extract the reservation flags for '
452+ f' reservation { resv !r } ' )
453453
454- completed = _run_strict ('scontrol -a show -o %s' % reservation_nodes )
454+ completed = _run_strict (
455+ f'scontrol -a show -o nodes { reservation_nodes } '
456+ )
455457 node_descriptions = completed .stdout .splitlines ()
456458 return _create_nodes (node_descriptions )
457459
458460 def _get_nodes_by_name (self , nodespec ):
459- completed = osext .run_command ('scontrol -a show -o node %s' %
461+ completed = osext .run_command ('scontrol -a show -o nodes %s' %
460462 nodespec )
461463 node_descriptions = completed .stdout .splitlines ()
462464 return _create_nodes (node_descriptions )
@@ -748,6 +750,9 @@ def __eq__(self, other):
748750 def __hash__ (self ):
749751 return hash (self .name )
750752
753+ def __repr__ (self ):
754+ return f'_SlurmNode({ self .name !r} )'
755+
751756 def in_state (self , state ):
752757 return all ([self ._states >= set (state .upper ().split ('+' )),
753758 self ._partitions , self ._active_features , self ._states ])
0 commit comments