fix: reconcile runner job observations
This commit is contained in:
@@ -148,6 +148,7 @@ async function dispatch(args: ParsedArgs): Promise<CliResult> {
|
||||
if (group === "runner" && command === "job") return renderRunnerJob(args);
|
||||
if (group === "runner" && command === "jobs") return listRunnerJobs(args);
|
||||
if (group === "runner" && command === "job-status") return showRunnerJobStatus(args);
|
||||
if (group === "runner" && command === "reconcile") return reconcileRunnerJobs(args);
|
||||
throw new AgentRunError("schema-invalid", `unsupported command: ${args.positional.join(" ")}`, { httpStatus: 2 });
|
||||
}
|
||||
|
||||
@@ -1496,6 +1497,20 @@ async function showRunnerJobStatus(args: ParsedArgs): Promise<JsonValue> {
|
||||
return client(args).get(`/api/v1/runs/${encodeURIComponent(runId)}/runner-jobs/${encodeURIComponent(runnerJobId)}`);
|
||||
}
|
||||
|
||||
async function reconcileRunnerJobs(args: ParsedArgs): Promise<JsonValue> {
|
||||
const body: JsonRecord = {};
|
||||
const limit = optionalFlag(args, "limit");
|
||||
const namespace = optionalFlag(args, "namespace");
|
||||
if (limit) {
|
||||
const parsed = Number(limit);
|
||||
if (!Number.isInteger(parsed) || parsed <= 0) throw new AgentRunError("schema-invalid", "runner reconcile --limit must be a positive integer", { httpStatus: 2 });
|
||||
body.limit = parsed;
|
||||
}
|
||||
if (namespace) body.namespace = namespace;
|
||||
if (args.flags.get("dry-run") === true) return { action: "runner-job-reconcile", method: "POST", path: "/api/v1/reconciler/runner-jobs", body, valuesPrinted: false };
|
||||
return client(args).post("/api/v1/reconciler/runner-jobs", body);
|
||||
}
|
||||
|
||||
async function renderRunnerJob(args: ParsedArgs): Promise<JsonRecord> {
|
||||
const runId = flag(args, "run-id", "");
|
||||
const commandId = flag(args, "command-id", "");
|
||||
@@ -2055,6 +2070,7 @@ function help(args: ParsedArgs, group?: string): JsonRecord {
|
||||
"runner job --dry-run --run-id <runId> --command-id <commandId> --image <image>",
|
||||
"runner jobs --run-id <runId> [--command-id <commandId>]",
|
||||
"runner job-status [runnerJobId] --run-id <runId>",
|
||||
"runner reconcile [--limit <n>] [--namespace <namespace>] [--dry-run]",
|
||||
"queue submit --json-stdin|--json-file <task.json> [--idempotency-key <key>] [--dry-run]",
|
||||
"queue submit --aipod <name> [--prompt-stdin|--prompt-file <file>|--prompt <text>] [--idempotency-key <key>] [--dry-run]",
|
||||
"queue list [--queue <queue>] [--state <state>] [--cursor <cursor>] [--limit <limit>] [--updated-after <version>] [--full|--raw]",
|
||||
|
||||
Reference in New Issue
Block a user