File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,14 @@ def filter_nodes_by_state(nodelist, state):
165165 state string.
166166 :returns: the filtered node list
167167 '''
168- if state == 'avail' :
168+ if '|' in state :
169+ allowed_states = state .split ('|' )
170+ final_nodelist = set ()
171+ for s in allowed_states :
172+ final_nodelist .update (filter_nodes_by_state (nodelist , s ))
173+
174+ nodelist = final_nodelist
175+ elif state == 'avail' :
169176 nodelist = {n for n in nodelist if n .is_avail ()}
170177 elif state != 'all' :
171178 if state .endswith ('*' ):
Original file line number Diff line number Diff line change @@ -1247,6 +1247,19 @@ def test_flex_alloc_not_enough_nodes_constraint_expr(make_flexible_job):
12471247 prepare_job (job )
12481248
12491249
1250+ def test_flex_alloc_allocated_or_idle_partition (make_flexible_job ):
1251+ job = make_flexible_job ('allocated|idle' )
1252+ job .options = ['--partition=p3' ]
1253+ prepare_job (job )
1254+ assert job .num_tasks == 12
1255+
1256+
1257+ def test_flex_alloc_maint_star_or_allocated (make_flexible_job ):
1258+ job = make_flexible_job ('maint*|idle' )
1259+ prepare_job (job )
1260+ assert job .num_tasks == 16
1261+
1262+
12501263@pytest .fixture
12511264def slurm_node_allocated ():
12521265 return _SlurmNode (
You can’t perform that action at this time.
0 commit comments