def load_runs(args):
    (total, toload) = ([], [])
    for indir in args.indir:
        filenames = list(indir.glob('**/*.jsonl'))
        total += filenames
        for filename in filenames:
            (task, method, seed) = filename.relative_to(indir).parts[:(- 1)]
            if (not any((p.search(task) for p in args.tasks))):
                continue
            if (not any((p.search(method) for p in args.methods))):
                continue
            toload.append((filename, indir))
    print(f'Loading {len(toload)} of {len(total)} runs...')
    jobs = [functools.partial(load_run, f, i, args) for (f, i) in toload]
    with mp.Pool(10) as pool:
        promises = [pool.apply_async(j) for j in jobs]
        runs = [p.get() for p in promises]
    runs = [r for r in runs if (r is not None)]
    return runs
def load_runs(args):
    (total, toload) = ([], [])
    for indir in args.indir:
        filenames = list(indir.glob('**/*.jsonl'))
        total += filenames
        for filename in filenames:
            (task, method, seed) = filename.relative_to(indir).parts[:(- 1)]
            if (not any((p.search(task) for p in args.tasks))):
                continue
            if (not any((p.search(method) for p in args.methods))):
                continue
            toload.append((filename, indir))
    print(f'Loading {len(toload)} of {len(total)} runs...')
    jobs = [functools.partial(load_run, f, i, args) for (f, i) in toload]
    with mp.Pool(10) as pool:
        promises = [pool.apply_async(j) for j in jobs]
        runs = [p.get() for p in promises]
    runs = [r for r in runs if (r is not None)]
    return runs