MCPcopy Create free account
hub / github.com/modelscope/modelscope / wait_for_workers

Function wait_for_workers

tests/run.py:242–267  ·  view source on GitHub ↗
(workers)

Source from the content-addressed store, hash-verified

240
241
242def wait_for_workers(workers):
243 while True:
244 for idx, worker in enumerate(workers):
245 if worker is None:
246 continue
247 # check worker is completed.
248 if worker.poll() is None:
249 for line in iter(worker.stdout.readline, ''):
250 if line != '':
251 sys.stdout.write(line)
252 else:
253 break
254 else:
255 logger.info('Process idx: %s end!' % (idx))
256 workers[idx] = None
257
258 is_all_completed = True
259 for idx, worker in enumerate(workers):
260 if worker is not None:
261 is_all_completed = False
262 break
263
264 if is_all_completed:
265 logger.info('All sub process is completed!')
266 break
267 time.sleep(0.001)
268
269
270def parallel_run_case(isolated_cases, result_dir, parallel):

Callers 2

parallel_run_caseFunction · 0.85
parallel_run_case_in_envFunction · 0.85

Calls 2

infoMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…