Skip to content

Commit c3c4863

Browse files
committed
feat: bump to @guidebooks/[email protected] to pick up more flexible (non-ray) vmstat tracking
guidebooks/store#576
1 parent ccd5711 commit c3c4863

File tree

5 files changed

+41
-21
lines changed

5 files changed

+41
-21
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/plugin-codeflare/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@types/split2": "^3.2.1"
3131
},
3232
"dependencies": {
33-
"@guidebooks/store": "^5.1.7",
33+
"@guidebooks/store": "^5.2.0",
3434
"@logdna/tail-file": "^3.0.1",
3535
"@patternfly/react-charts": "^6.94.18",
3636
"@patternfly/react-core": "^4.276.6",

plugins/plugin-codeflare/src/controller/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import charts from "./charts"
2424
import events from "./events"
2525
import dashboard from "./dashboard"
2626
import description from "./description"
27+
import { LogsOptions, logsFlags } from "./logs"
2728
import { Options as AttachOptions } from "./attach"
28-
import { ProfileOptions, profileFlags } from "./options"
2929

3030
function help() {
3131
return `Usage:
@@ -43,11 +43,9 @@ export default function registerCodeflareCommands(registrar: Registrar) {
4343
description(registrar)
4444
registrar.listen("/help", help)
4545

46-
registrar.listen<KResponse, ProfileOptions>(
47-
"/codeflare/logs",
48-
(args) => import("./logs").then((_) => _.default(args)),
49-
{ flags: profileFlags }
50-
)
46+
registrar.listen<KResponse, LogsOptions>("/codeflare/logs", (args) => import("./logs").then((_) => _.default(args)), {
47+
flags: logsFlags,
48+
})
5149

5250
registrar.listen<KResponse, AttachOptions>(
5351
"/codeflare/attach",

plugins/plugin-codeflare/src/controller/logs.ts

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,44 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Arguments } from "@kui-shell/core"
18-
import { MadWizardOptions } from "madwizard"
17+
import type { Arguments } from "@kui-shell/core"
18+
import type { MadWizardOptions } from "madwizard"
1919

2020
import appName from "./appName"
21-
import { ProfileOptions } from "./options"
21+
import { ProfileOptions, profileFlags } from "./options"
2222

23-
export default async function logs(args: Arguments<ProfileOptions>) {
23+
export type LogsOptions = ProfileOptions & {
24+
l: string
25+
"label-selector": string
26+
}
27+
28+
export const logsFlags = Object.assign({}, profileFlags, {
29+
alias: Object.assign({}, profileFlags.alias, {
30+
"label-selector": ["l"],
31+
}),
32+
})
33+
34+
export default async function logs(args: Arguments<LogsOptions>) {
2435
// Display logs for this jobID; if not provided, the user will be
2536
// prompted (via the guidebook) to choose one
2637
const jobId = args.argvNoOptions[args.argvNoOptions.indexOf("logs") + 1]
2738
if (jobId) {
2839
process.env.JOB_ID = jobId
2940
}
3041

42+
// query by label selector?
43+
const byLabelSelector = typeof args.parsedOptions.l === "string"
44+
if (byLabelSelector) {
45+
process.env.WAIT = "true"
46+
process.env.KUBE_POD_LABEL_SELECTOR = args.parsedOptions.l
47+
}
48+
3149
// play this guidebook
32-
const guidebook = jobId === undefined ? "ml/ray/aggregator" : "ml/ray/aggregator/with-jobid"
50+
const guidebook = byLabelSelector
51+
? "ml/ray/run/pod-stats"
52+
: jobId === undefined
53+
? "ml/ray/aggregator"
54+
: "ml/ray/aggregator/with-jobid"
3355

3456
// but only interactive starting here
3557
const ifor =

plugins/plugin-codeflare/src/controller/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type ProfileOptions = ParsedOptions & {
2525
verbose: string
2626
}
2727

28-
export const profileFlags: CommandOptions["flags"] = {
28+
export const profileFlags: Required<Pick<CommandOptions, "flags">>["flags"] = {
2929
boolean: ["V", "verbose"],
3030
alias: {
3131
verbose: ["V"],

0 commit comments

Comments
 (0)