Skip to content

Commit dac71c1

Browse files
committed
fix: add codeflare dump path to print out location of files
1 parent f94cfc2 commit dac71c1

File tree

1 file changed

+10
-2
lines changed
  • plugins/plugin-codeflare-dashboard/src/controller

1 file changed

+10
-2
lines changed

plugins/plugin-codeflare-dashboard/src/controller/dump.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,25 @@ function usage() {
3434
return dbUsage("dump") + " [-f/--follow]"
3535
}
3636

37+
/** Dump raw info, rather than nicely formatted into a dashboard */
3738
export default async function dump(args: Arguments<Options>) {
39+
// what kind of data are we being asked to show
3840
const kind = args.argvNoOptions[args.argvNoOptions.indexOf("dump") + 1]
41+
42+
// and for which jobId and profile?
3943
const { jobId, profile } = await jobIdFrom(args, "dump")
4044

41-
if (!isValidKind(kind)) {
45+
if (!(isValidKind(kind) || kind === "path")) {
4246
throw new Error(usage())
4347
} else if (!jobId) {
4448
throw new Error(usage())
4549
}
4650

47-
if (!args.parsedOptions.f) {
51+
if (kind === "path") {
52+
// print the path to the data captured for the given jobId in the given profile
53+
const { dirname } = await import("path")
54+
return Array.from(new Set(await pathsFor("cpu", profile, jobId).then((_) => _.map((_) => dirname(_)))))[0]
55+
} else if (!args.parsedOptions.f) {
4856
const { createReadStream } = await import("fs")
4957
await Promise.all(
5058
(

0 commit comments

Comments
 (0)