(
workdir: Path,
case: TestCase,
slurm_cli: Optional[SlurmCliOptions] = None,
postprocess_only: bool = False,
)
| 57 | |
| 58 | |
| 59 | def run_test_case( |
| 60 | workdir: Path, |
| 61 | case: TestCase, |
| 62 | slurm_cli: Optional[SlurmCliOptions] = None, |
| 63 | postprocess_only: bool = False, |
| 64 | ): |
| 65 | descriptors = list(case.generate_descriptors()) |
| 66 | has_work = has_work_left(workdir, descriptors) |
| 67 | |
| 68 | def compute(): |
| 69 | if has_work and not postprocess_only: |
| 70 | database = run_benchmarks_with_postprocessing(workdir, descriptors) |
| 71 | else: |
| 72 | database = load_or_create_database(workdir) |
| 73 | |
| 74 | # Keep only results that we are interested in, there might be some old stale results |
| 75 | identifiers = [instance.identifier for instance in create_benchmark_instances(descriptors, workdir=workdir)] |
| 76 | database = database.filter(identifiers) |
| 77 | case.postprocess(workdir=workdir, database=database) |
| 78 | |
| 79 | if not postprocess_only and has_work and slurm_cli is not None: |
| 80 | run_in_slurm( |
| 81 | SlurmOptions( |
| 82 | name="slurm-auto-submit", |
| 83 | queue=slurm_cli.queue, |
| 84 | project=slurm_cli.project, |
| 85 | walltime=datetime.timedelta(hours=slurm_cli.walltime_h), |
| 86 | init_script=slurm_cli.init_script.absolute(), |
| 87 | node_count=slurm_cli.node_count, |
| 88 | workdir=Path("slurm").absolute(), |
| 89 | wait_for_job=slurm_cli.wait_for_job, |
| 90 | ), |
| 91 | compute, |
| 92 | ) |
| 93 | else: |
| 94 | compute() |
| 95 | |
| 96 | |
| 97 | def register_case(app: Typer): |
no test coverage detected