Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add resources allocation-csv to det cli [DFR-519] #9649

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions harness/determined/cli/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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,
Expand Down
Loading