@@ -87,13 +87,13 @@ def assign_resources(self, rsets_req, use_gpus=None, user_params=[]):
8787 rset_team = self .sched .assign_resources (rsets_req , use_gpus , user_params )
8888 return rset_team
8989
90- def avail_worker_ids (self , persistent = None , active_recv = False , zero_resource_workers = None , gen_workers = False ):
90+ def avail_worker_ids (self , persistent = None , active_recv = False , zero_resource_workers = None , gen_workers = None ):
9191 """Returns available workers as a list of IDs, filtered by the given options.
9292
9393 :param persistent: (Optional) Int. Only return workers with given ``persis_state`` (1=sim, 2=gen).
9494 :param active_recv: (Optional) Boolean. Only return workers with given active_recv state.
9595 :param zero_resource_workers: (Optional) Boolean. Only return workers that require no resources.
96- :param gen_workers: (Optional) Boolean. If True, return gen-only workers.
96+ :param gen_workers: (Optional) Boolean. If True, return gen-only workers. If False, return all other workers.
9797 :returns: List of worker IDs.
9898
9999 If there are no zero resource workers defined, then the ``zero_resource_workers`` argument will
@@ -119,16 +119,17 @@ def fltr_recving():
119119 return wrk ["active" ] == 0
120120
121121 def fltr_gen_workers ():
122- if gen_workers :
123- return wrk ["gen_worker" ]
124- else :
122+ if no_gen_workers or gen_workers is None :
125123 return True
124+ return wrk ["gen_worker" ] == gen_workers
126125
127126 if active_recv and not persistent :
128127 raise AllocException ("Cannot ask for non-persistent active receive workers" )
129128
130129 # If there are no zero resource workers - then ignore zrw (i.e., use only if they exist)
131130 no_zrw = not any (self .W ["zero_resource_worker" ])
131+ no_gen_workers = not any (self .W ["gen_worker" ])
132+
132133 wrks = []
133134 for wrk in self .W :
134135 if fltr_recving () and fltr_persis () and fltr_zrw () and fltr_gen_workers ():
0 commit comments