From 80f864554affc92c230a50bce6441c94e97b0cb8 Mon Sep 17 00:00:00 2001 From: Tim Tucker Date: Fri, 12 Jul 2024 11:18:28 -0400 Subject: [PATCH] feat: Add resources allocation-csv to det cli --- harness/determined/cli/resources.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/harness/determined/cli/resources.py b/harness/determined/cli/resources.py index d15685afb6a..0051d4a8145 100644 --- a/harness/determined/cli/resources.py +++ b/harness/determined/cli/resources.py @@ -12,6 +12,13 @@ def print_response(r: requests.Response) -> None: sys.stdout.buffer.write(chunk) +def csv(args: argparse.Namespace) -> None: + sess = cli.setup_session(args) + params = {"timestamp_after": args.timestamp_after, "timestamp_before": args.timestamp_before} + path = "resources/allocation/allocations-csv" + print_response(sess.get(path, params=params)) + + def raw(args: argparse.Namespace) -> None: sess = cli.setup_session(args) params = {"timestamp_after": args.timestamp_after, "timestamp_before": args.timestamp_before} @@ -40,6 +47,15 @@ def aggregated(args: argparse.Namespace) -> None: None, "query historical resource allocation", [ + cli.Cmd( + "all|ocations", + csv, + "get a detailed csv of resource allocation at an allocation level", + [ + cli.Arg("timestamp_after"), + cli.Arg("timestamp_before"), + ], + ), cli.Cmd( "raw", raw,