|
6 | 6 | from pathlib import Path |
7 | 7 | import logging |
8 | 8 |
|
9 | | -from omegaconf import DictConfig, OmegaConf |
10 | | -import hydra |
11 | | - |
12 | 9 | from commit0.harness.constants import RUN_PYTEST_LOG_DIR |
13 | 10 | from commit0.harness.docker_build import ( |
14 | 11 | close_logger, |
@@ -196,39 +193,46 @@ def run_modal( |
196 | 193 | ) |
197 | 194 |
|
198 | 195 |
|
199 | | -@hydra.main(version_base=None, config_path="configs", config_name="base") |
200 | | -def main(config: DictConfig) -> None: |
201 | | - OmegaConf.to_yaml(config) |
202 | | - dataset = load_dataset(config.dataset_name, split="test") |
| 196 | +def main( |
| 197 | + dataset_name: str, |
| 198 | + dataset_split: str, |
| 199 | + base_dir: str, |
| 200 | + repo: str, |
| 201 | + branch: str, |
| 202 | + test_ids: str, |
| 203 | + backend: str, |
| 204 | + timeout: int, |
| 205 | +) -> None: |
| 206 | + dataset = load_dataset(dataset_name, split="test") |
203 | 207 | spec = None |
204 | 208 | for example in dataset: |
205 | | - if example["repo"].endswith(config.repo): |
| 209 | + if example["repo"].endswith(repo): |
206 | 210 | spec = make_spec(example) |
207 | 211 | break |
208 | 212 | assert spec is not None, "No spec available" |
209 | 213 |
|
210 | | - hashed_test_ids = get_hash_string(config.test_ids) |
| 214 | + hashed_test_ids = get_hash_string(test_ids) |
211 | 215 | # set up logging |
212 | | - log_dir = RUN_PYTEST_LOG_DIR / config.repo / hashed_test_ids |
| 216 | + log_dir = RUN_PYTEST_LOG_DIR / repo / hashed_test_ids |
213 | 217 | log_dir.mkdir(parents=True, exist_ok=True) |
214 | 218 | log_file = log_dir / "run_pytest.log" |
215 | | - logger = setup_logger(config.repo, log_file) |
| 219 | + logger = setup_logger(repo, log_file) |
216 | 220 |
|
217 | 221 | # make eval file |
218 | 222 | eval_script = spec.eval_script.format( |
219 | | - local_repo=f"{config.base_dir}/{config.repo}", |
220 | | - branch_name=config.branch, |
221 | | - test_ids=config.test_ids, |
222 | | - ip=get_ip(config.backend), |
| 223 | + local_repo=f"{base_dir}/{repo}", |
| 224 | + branch_name=branch, |
| 225 | + test_ids=test_ids, |
| 226 | + ip=get_ip(backend), |
223 | 227 | user=get_user(), |
224 | 228 | ) |
225 | 229 | eval_file = Path(log_dir / "eval.sh") |
226 | 230 | eval_file.write_text(eval_script) |
227 | 231 |
|
228 | | - if ExecutionBackend(config.backend) == ExecutionBackend.LOCAL: |
229 | | - run_docker(spec, logger, eval_file, config.timeout, log_dir) |
230 | | - elif ExecutionBackend(config.backend) == ExecutionBackend.MODAL: |
231 | | - run_modal(spec, logger, eval_file, config.timeout, log_dir) |
| 232 | + if ExecutionBackend(backend) == ExecutionBackend.LOCAL: |
| 233 | + run_docker(spec, logger, eval_file, timeout, log_dir) |
| 234 | + elif ExecutionBackend(backend) == ExecutionBackend.MODAL: |
| 235 | + run_modal(spec, logger, eval_file, timeout, log_dir) |
232 | 236 |
|
233 | 237 |
|
234 | 238 | __all__ = [] |
0 commit comments