(
database_path: Path = typer.Argument(..., exists=True),
token: str = typer.Option(...),
)
| 31 | |
| 32 | @app.command() |
| 33 | def upload( |
| 34 | database_path: Path = typer.Argument(..., exists=True), |
| 35 | token: str = typer.Option(...), |
| 36 | ): |
| 37 | client = Client("https://snailwatch.it4i.cz/api", token) |
| 38 | database = load_database(database_path) |
| 39 | measurements = [] |
| 40 | |
| 41 | for record in database.records: |
| 42 | timestamp = datetime.fromtimestamp(record.timestamp) |
| 43 | measurement = Measurement( |
| 44 | benchmark=record.workload, |
| 45 | environment=dict( |
| 46 | **normalize_dict(record.workload_params, "workload"), |
| 47 | **normalize_dict(record.environment_params, "env"), |
| 48 | env=record.environment_params, |
| 49 | **normalize_dict(record.benchmark_metadata, "metadata"), |
| 50 | ), |
| 51 | result=dict(duration=dict(type="time", value=record.duration)), |
| 52 | timestamp=timestamp, |
| 53 | ) |
| 54 | measurements.append(measurement) |
| 55 | |
| 56 | client.upload_measurements(measurements) |
| 57 | |
| 58 | |
| 59 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected