(
info_dict: Optional[Dict[str, Dict[str, List[Any]]]],
exclude_model: str,
type: str,
**kwargs,
)
| 70 | |
| 71 | |
| 72 | def parallel_greedy_cover( |
| 73 | info_dict: Optional[Dict[str, Dict[str, List[Any]]]], |
| 74 | exclude_model: str, |
| 75 | type: str, |
| 76 | **kwargs, |
| 77 | ) -> Dict[str, List[str]]: |
| 78 | plus_tests = {task_id: [] for task_id in task_ids} |
| 79 | |
| 80 | with ProcessPoolExecutor(max_workers=32) as executor: |
| 81 | futures = [] |
| 82 | for task_id in task_ids: |
| 83 | if type == "sample": |
| 84 | path_task_id = to_path(task_id) |
| 85 | sample_dir = kwargs["sample_dir"] |
| 86 | with open(os.path.join(sample_dir, f"{path_task_id}.pkl"), "rb") as f: |
| 87 | td = pickle.load(f) |
| 88 | args = (task_id, td, exclude_model) |
| 89 | else: |
| 90 | args = (task_id, info_dict[task_id], exclude_model) |
| 91 | futures.append(executor.submit(greedy_cover, *args)) |
| 92 | for future in track(as_completed(futures), f"min set cover :: {type}"): |
| 93 | task_id, min_cover = future.result() |
| 94 | plus_tests[task_id] = min_cover |
| 95 | |
| 96 | return plus_tests |
| 97 | |
| 98 | |
| 99 | ##################### |
no test coverage detected