forked from It4innovations/hyperqueue
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostprocess.py
More file actions
80 lines (64 loc) · 2.47 KB
/
postprocess.py
File metadata and controls
80 lines (64 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import logging
from pathlib import Path
import typer
from src.postprocessing.monitor import generate_cluster_report
from src.postprocessing.overview import generate_summary_html, generate_summary_text
from src.postprocessing.report import ClusterReport
from src.postprocessing.serve import serve_cluster_report, serve_summary_html
from src.utils.benchmark import load_database
app = typer.Typer()
cluster = typer.Typer()
app.add_typer(cluster, name="cluster", help="Cluster utilization")
summary = typer.Typer()
app.add_typer(summary, name="summary", help="Result summary")
@cluster.command("serve")
def cluster_serve(
directory: Path = typer.Argument(..., exists=True, file_okay=False),
port: int = 5555,
):
"""Serve a HTML file with monitoring and profiling report for the given directory"""
report = ClusterReport.load(directory)
serve_cluster_report(report, port=port)
@cluster.command("generate")
def cluster_generate(
directory: Path = typer.Argument(
..., exists=True, file_okay=False, help="Directory containing `cluster.json`"
),
output: Path = Path("out.html"),
):
"""Generate a HTML file with monitoring and profiling report for the given directory"""
report = ClusterReport.load(directory)
generate_cluster_report(report, output=output)
@summary.command("text")
def summary_text(
database_path: Path = typer.Argument(..., exists=True),
output: Path = Path("summary.txt"),
):
"""Generate a simple text summary of benchmark results"""
database = load_database(database_path)
generate_summary_text(database, output)
@summary.command("html")
def summary_html(
database_path: Path = typer.Argument(..., exists=True),
directory: Path = Path("summary"),
):
"""Generate a HTML summary of benchmark results into the given `directory`"""
database = load_database(database_path)
file = generate_summary_html(database, directory)
logging.info(f"You can find the summary in {file}")
@summary.command("serve")
def serve_html(
database_path: Path = typer.Argument(..., exists=True),
directory: Path = Path("summary"),
port: int = 5555,
):
"""Serves a HTML summary of benchmark results, includes comparisons"""
database = load_database(database_path)
serve_summary_html(database, directory, port)
if __name__ == "__main__":
logging.basicConfig(
level=logging.INFO,
format="%(levelname)s:%(asctime)s:%(funcName)s: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
app()