(descriptor: BenchmarkDescriptor, ctx: BenchmarkContext)
| 15 | |
| 16 | |
| 17 | def execute_benchmark(descriptor: BenchmarkDescriptor, ctx: BenchmarkContext) -> BenchmarkResult: |
| 18 | env = descriptor.env_descriptor.create_environment(ctx.workdir) |
| 19 | workload = descriptor.workload |
| 20 | |
| 21 | def run() -> WorkloadExecutionResult: |
| 22 | return workload.execute(env) |
| 23 | |
| 24 | try: |
| 25 | with env: |
| 26 | result = with_timeout(run, timeout_s=ctx.timeout_s) |
| 27 | return Success(duration=result.duration) |
| 28 | except TimeoutException: |
| 29 | return Timeout(ctx.timeout_s) |
| 30 | except BaseException: |
| 31 | return Failure(traceback.format_exc()) |
no test coverage detected