(
*,
images: list[Path],
discovered_run_dir: Path | None,
output_path: str,
workspace_dir: str,
)
| 138 | |
| 139 | |
| 140 | def _resolve_artifact_dir( |
| 141 | *, |
| 142 | images: list[Path], |
| 143 | discovered_run_dir: Path | None, |
| 144 | output_path: str, |
| 145 | workspace_dir: str, |
| 146 | ) -> Path | None: |
| 147 | candidates: list[Path] = [] |
| 148 | |
| 149 | inferred_run_dir = _infer_run_dir_from_images(images) |
| 150 | if inferred_run_dir is not None: |
| 151 | candidates.append(inferred_run_dir) |
| 152 | |
| 153 | if discovered_run_dir is not None: |
| 154 | candidates.append(discovered_run_dir.resolve()) |
| 155 | |
| 156 | if output_path: |
| 157 | candidates.append(Path(output_path).resolve().parent) |
| 158 | |
| 159 | base_dir = Path(workspace_dir).resolve() if workspace_dir else Path.cwd().resolve() |
| 160 | candidates.append(base_dir) |
| 161 | |
| 162 | seen: set[Path] = set() |
| 163 | ordered_candidates: list[Path] = [] |
| 164 | for candidate in candidates: |
| 165 | if candidate in seen: |
| 166 | continue |
| 167 | seen.add(candidate) |
| 168 | ordered_candidates.append(candidate) |
| 169 | |
| 170 | for candidate in ordered_candidates: |
| 171 | if (candidate / "final_script_log.txt").is_file(): |
| 172 | return candidate |
| 173 | |
| 174 | return ordered_candidates[0] if ordered_candidates else None |
| 175 | |
| 176 | |
| 177 | def _load_action_history_log(artifact_dir: Path | None) -> str: |
no test coverage detected