@classmethod
def check_no_running_workers(cls, patience=5, sleep_duration=0.01):
    deadline = (time.time() + patience)
    while (time.time() <= deadline):
        time.sleep(sleep_duration)
        p = psutil.Process()
        workers = _running_children_with_cmdline(p)
        if (not workers):
            return
    print('Remaining worker processes command lines:', file=sys.stderr)
    for (w, cmdline) in workers:
        print(w.pid, w.status(), end='\n', file=sys.stderr)
        print(cmdline, end='\n\n', file=sys.stderr)
    raise AssertionError(f'Expected no more running worker processes but got {len(workers)} after waiting {patience:0.3f}s.')
@classmethod
def check_no_running_workers(cls, patience=5, sleep_duration=0.01):
    deadline = (time.time() + patience)
    while (time.time() <= deadline):
        time.sleep(sleep_duration)
        p = psutil.Process()
        workers = _running_children_with_cmdline(p)
        if (not workers):
            return
    print('Remaining worker processes command lines:', file=sys.stderr)
    for (w, cmdline) in workers:
        print(w.pid, w.status(), end='\n', file=sys.stderr)
        print(cmdline, end='\n\n', file=sys.stderr)
    raise AssertionError(f'Expected no more running worker processes but got {len(workers)} after waiting {patience:0.3f}s.')