This is an automated email from the ASF dual-hosted git repository.
DImuthuUpe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/master by this push:
new fef308ae7c Improving process page UX (#757)
fef308ae7c is described below
commit fef308ae7cab8ddd771b7176e6c7a18ea9f822f9
Author: Dimuthu Wannipurage <[email protected]>
AuthorDate: Mon Nov 9 06:41:00 2026 -0500
Improving process page UX (#757)
---
api/process/dto/task.go | 2 +
api/process/model/task.go | 4 +
dashboard/src/app/globals.css | 380 +++++++++
dashboard/src/app/processes/view/page.tsx | 889 ++++++++++++++++-----
dashboard/src/components/ui.tsx | 7 +-
docs/api.md | 3 +
docs/openapi.yaml | 5 +
.../db/migrations/0009_job_submission_script.sql | 6 +
internal/mcp/client/client.gen.go | 10 +-
internal/orchestration/tasks/batch/batch.go | 8 +
10 files changed, 1101 insertions(+), 213 deletions(-)
diff --git a/api/process/dto/task.go b/api/process/dto/task.go
index 231b5b2dc1..356c167d18 100644
--- a/api/process/dto/task.go
+++ b/api/process/dto/task.go
@@ -175,6 +175,7 @@ type JobSubmissionTaskResponse struct {
JobID *string `json:"jobId"`
WorkingDir *string `json:"workingDir"`
+ Script *string `json:"script"`
OnFailure *model.OnFailureAction `json:"onFailure"`
RetryCount *int `json:"retryCount"`
TaskOrder *int `json:"taskOrder"`
@@ -186,6 +187,7 @@ func ToJobSubmissionTaskResponse(t
*model.JobSubmissionTask) JobSubmissionTaskRe
ProcessID: t.ProcessID,
JobID: t.JobId,
WorkingDir: t.WorkingDir,
+ Script: t.Script,
OnFailure: t.OnFailure,
RetryCount: t.RetryCount,
TaskOrder: t.TaskOrder,
diff --git a/api/process/model/task.go b/api/process/model/task.go
index 997bba8108..c90de58b74 100644
--- a/api/process/model/task.go
+++ b/api/process/model/task.go
@@ -82,6 +82,10 @@ type JobSubmissionTask struct {
WorkingDir *string `gorm:"column:working_dir;type:varchar(1024)"
json:"workingDir,omitempty"`
+ // Script is the batch script the task last built and submitted,
recorded by the
+ // server so a run can be inspected afterwards.
+ Script *string `gorm:"column:script;type:text" json:"script,omitempty"`
+
OnFailure *OnFailureAction `gorm:"column:on_failure;type:varchar(32)"
json:"onFailure,omitempty"`
RetryCount *int `gorm:"column:retry_count;type:int"
json:"retryCount,omitempty"`
diff --git a/dashboard/src/app/globals.css b/dashboard/src/app/globals.css
index 5d023f1775..0cb7687118 100644
--- a/dashboard/src/app/globals.css
+++ b/dashboard/src/app/globals.css
@@ -547,6 +547,369 @@ dl.kv dd {
border-bottom: none;
}
+/* Process view */
+
+.nowrap {
+ white-space: nowrap;
+}
+
+.dot.pulse {
+ animation: pulse 1.6s ease-in-out infinite;
+}
+@keyframes pulse {
+ 50% {
+ opacity: 0.35;
+ }
+}
+.row.live {
+ gap: 6px;
+}
+
+.summary {
+ padding: 16px 20px;
+ display: flex;
+ flex-direction: column;
+ gap: 18px;
+}
+dl.facts {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
+ gap: 12px 24px;
+ margin: 0;
+}
+dl.facts dt {
+ font-size: 11.5px;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ color: var(--muted);
+ margin-bottom: 4px;
+}
+dl.facts dd {
+ margin: 0;
+ font-weight: 500;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.stepper {
+ list-style: none;
+ margin: 0;
+ padding: 14px 0 0;
+ border-top: 1px solid var(--border);
+ display: flex;
+ gap: 8px;
+}
+.stepper li {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ min-width: 0;
+}
+.stepper li:last-child {
+ flex: none;
+}
+.stepper li:not(:last-child)::after {
+ content: "";
+ flex: 1;
+ height: 2px;
+ min-width: 16px;
+ background: var(--border);
+ border-radius: 1px;
+}
+.stepper li.done:not(:last-child)::after {
+ background: var(--ok);
+}
+.stepper .marker {
+ flex: none;
+ width: 26px;
+ height: 26px;
+ border-radius: 50%;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 12px;
+ font-weight: 700;
+ border: 2px solid var(--border);
+ color: var(--muted);
+ background: var(--surface);
+}
+.stepper li.done .marker {
+ background: var(--ok);
+ border-color: var(--ok);
+ color: var(--surface);
+}
+.stepper li.running .marker {
+ border-color: var(--info);
+ color: var(--info);
+ background: var(--info-soft);
+ animation: pulse 1.6s ease-in-out infinite;
+}
+.stepper li.failed .marker {
+ background: var(--danger);
+ border-color: var(--danger);
+ color: var(--surface);
+}
+.stepper .step-text {
+ display: flex;
+ flex-direction: column;
+ line-height: 1.3;
+ white-space: nowrap;
+}
+.stepper .step-label {
+ font-weight: 600;
+}
+.stepper li.pending .step-label {
+ color: var(--muted);
+}
+
+.tabs .count {
+ display: inline-block;
+ min-width: 18px;
+ padding: 0 6px;
+ margin-left: 4px;
+ border-radius: 999px;
+ background: var(--surface-2);
+ color: var(--muted);
+ font-size: 11px;
+ font-weight: 600;
+}
+.tabs button.active .count {
+ background: var(--accent-soft);
+ color: var(--accent);
+}
+/* The stack already spaces its children. */
+.stack > .tabs {
+ margin-bottom: 0;
+}
+
+.alert pre.failure {
+ margin-top: 8px;
+ background: var(--surface);
+ color: var(--text);
+ max-height: 280px;
+ overflow: auto;
+}
+
+.io-grid {
+ display: grid;
+ gap: 16px;
+}
+@media (min-width: 1280px) {
+ .io-grid {
+ grid-template-columns: 1fr 1fr;
+ align-items: start;
+ }
+}
+.product {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ min-width: 0;
+}
+
+.feed {
+ list-style: none;
+ margin: 0;
+ padding: 8px 16px;
+}
+.feed li {
+ position: relative;
+ display: flex;
+ gap: 14px;
+ padding: 8px 0;
+}
+.feed li::before {
+ content: "";
+ position: absolute;
+ left: 4px;
+ top: 0;
+ bottom: 0;
+ width: 2px;
+ background: var(--border);
+}
+.feed li:first-child::before {
+ top: 16px;
+}
+.feed li:last-child::before {
+ bottom: calc(100% - 16px);
+}
+.feed-dot {
+ position: relative;
+ flex: none;
+ width: 10px;
+ height: 10px;
+ margin-top: 6px;
+ border-radius: 50%;
+ background: var(--muted);
+ box-shadow: 0 0 0 3px var(--surface);
+}
+.feed-dot.ok {
+ background: var(--ok);
+}
+.feed-dot.info {
+ background: var(--info);
+}
+.feed-dot.warn {
+ background: var(--warn);
+}
+.feed-dot.danger {
+ background: var(--danger);
+}
+.feed-body {
+ flex: 1;
+ min-width: 0;
+}
+.log-line {
+ margin-top: 2px;
+ word-break: break-word;
+}
+details.log {
+ margin-top: 4px;
+}
+details.log > summary {
+ cursor: pointer;
+ font-size: 12px;
+ color: var(--accent);
+ width: max-content;
+}
+details.log > pre {
+ margin-top: 6px;
+ max-height: 320px;
+ overflow: auto;
+}
+
+.task-list details.task {
+ border-bottom: 1px solid var(--border);
+}
+.task-list details.task:last-child {
+ border-bottom: none;
+}
+details.task > summary {
+ list-style: none;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 11px 16px;
+ cursor: pointer;
+}
+details.task > summary::-webkit-details-marker {
+ display: none;
+}
+details.task > summary::after {
+ content: "›";
+ color: var(--muted);
+ font-size: 16px;
+ transition: transform 0.15s;
+}
+details.task[open] > summary::after {
+ transform: rotate(90deg);
+}
+details.task > summary:hover {
+ background: var(--surface-2);
+}
+.task .step {
+ flex: none;
+ width: 22px;
+ height: 22px;
+ border-radius: 50%;
+ background: var(--surface-2);
+ color: var(--muted);
+ font-size: 11.5px;
+ font-weight: 700;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+}
+.task-body {
+ padding: 4px 16px 16px 48px;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+}
+
+.route {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.transfer {
+ display: grid;
+ grid-template-columns: 1fr auto 1fr;
+ gap: 12px;
+ align-items: stretch;
+}
+.endpoint {
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ padding: 10px 12px;
+ background: var(--surface-2);
+ min-width: 0;
+}
+.endpoint-label {
+ font-size: 11px;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ color: var(--muted);
+ margin-bottom: 6px;
+}
+.endpoint-body {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ min-width: 0;
+}
+.endpoint-path {
+ display: block;
+ word-break: break-all;
+ padding: 4px 8px;
+ border-radius: 4px;
+ background: var(--surface);
+ border: 1px solid var(--border);
+}
+.endpoint dl.kv {
+ gap: 4px 16px;
+}
+.transfer-arrow {
+ align-self: center;
+ color: var(--muted);
+ font-size: 18px;
+}
+
+.script-head {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-bottom: 6px;
+}
+.script pre.block {
+ max-height: 420px;
+ overflow: auto;
+ white-space: pre;
+ word-break: normal;
+}
+
+dd.chips {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+ word-break: normal;
+}
+.chip {
+ display: inline-flex;
+ gap: 6px;
+ padding: 2px 10px;
+ border: 1px solid var(--border);
+ border-radius: 999px;
+ font-size: 12.5px;
+ background: var(--surface-2);
+}
+
/* Login */
.center {
@@ -572,4 +935,21 @@ dl.kv dd {
grid-template-columns: 1fr;
gap: 2px;
}
+ .stepper {
+ flex-direction: column;
+ align-items: flex-start;
+ }
+ .stepper li:not(:last-child)::after {
+ display: none;
+ }
+ .task-body {
+ padding-left: 16px;
+ }
+ .transfer {
+ grid-template-columns: 1fr;
+ }
+ .transfer-arrow {
+ transform: rotate(90deg);
+ justify-self: center;
+ }
}
diff --git a/dashboard/src/app/processes/view/page.tsx
b/dashboard/src/app/processes/view/page.tsx
index aee00a5b7f..e8c37bafa2 100644
--- a/dashboard/src/app/processes/view/page.tsx
+++ b/dashboard/src/app/processes/view/page.tsx
@@ -3,7 +3,7 @@
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { Suspense, useState } from "react";
-import { Alert, Card, formatTime, Id, PageHead, StatusBadge, Table } from
"@/components/ui";
+import { Alert, Card, formatTime, Id, PageHead, StatusBadge, statusTone,
Table, Tabs } from "@/components/ui";
import { api, errorText, tryGet } from "@/lib/api";
import { useDeploymentNames } from "@/lib/catalog";
import { useResource } from "@/lib/hooks";
@@ -14,6 +14,8 @@ import {
type ProcessStatus,
type ProcessWorkflow,
type ProcessWorkflowType,
+ type SCPDataStorage,
+ type SlurmClusterConfig,
type Task,
type TaskStatus,
type TaskType,
@@ -29,12 +31,34 @@ const TASK_KINDS: readonly { path: string; label: string;
type: TaskType }[] = [
{ path: "interactive-command-tasks", label: "Interactive commands", type:
"INTERACTIVE_COMMAND" },
];
+const WORKFLOW_STEPS: readonly { type: ProcessWorkflowType; label: string }[]
= [
+ { type: "BATCH_JOB_SUBMISSION", label: "Submission" },
+ { type: "JOB_MONITORING", label: "Monitoring" },
+ { type: "BATCH_JOB_COMPLETION", label: "Completion" },
+];
+
const WORKFLOW_LABELS: Record<ProcessWorkflowType, string> = {
BATCH_JOB_SUBMISSION: "Job submission",
JOB_MONITORING: "Job monitoring",
BATCH_JOB_COMPLETION: "Job completion",
};
+const RESOURCE_LABELS: Record<string, string> = {
+ wallTimeMinutes: "Wall time (min)",
+ allocation: "Allocation",
+ cpus: "CPUs",
+ mem: "Memory",
+ memPerCpu: "Mem / CPU",
+ ntasksPerNode: "Tasks / node",
+ cpusPerTask: "CPUs / task",
+ nodes: "Nodes",
+ ntasks: "Tasks",
+ gres: "GRES",
+ gpus: "GPUs",
+ memPerGpu: "Mem / GPU",
+ cpusPerGpu: "CPUs / GPU",
+};
+
// Whether a retry would be accepted, by the same rule the server applies: no
workflow
// is running, and the latest submission failed, or it succeeded and the latest
// completion failed. The server decides; this only chooses whether to offer
it.
@@ -48,7 +72,50 @@ function canRetry(workflows: ProcessWorkflow[] | null |
undefined): boolean {
}
// Fields every task carries; the rest are kind-specific and shown as they
come.
-const COMMON_TASK_FIELDS = new Set(["taskId", "processId", "onFailure",
"retryCount", "taskOrder"]);
+// Index of data staging tasks in TASK_KINDS, and so in the fetched task lists.
+const STAGING = TASK_KINDS.findIndex((k) => k.type === "DATA_STAGING");
+
+// script is left out too: a submission task's batch script gets a block of
its own.
+const COMMON_TASK_FIELDS = new Set(["taskId", "processId", "onFailure",
"retryCount", "taskOrder", "script"]);
+
+// shortTime drops the date for today's timestamps; the full time is in the
tooltip.
+function shortTime(ms: number | null | undefined): string {
+ if (!ms) return "—";
+ const d = new Date(ms);
+ if (d.toDateString() === new Date().toDateString()) return
d.toLocaleTimeString();
+ return d.toLocaleString(undefined, { month: "short", day: "numeric", hour:
"2-digit", minute: "2-digit" });
+}
+
+function Time({ ms }: { ms: number | null | undefined }) {
+ return (
+ <span className="small muted nowrap" title={formatTime(ms)}>
+ {shortTime(ms)}
+ </span>
+ );
+}
+
+function duration(ms: number): string {
+ const s = Math.max(0, Math.round(ms / 1000));
+ if (s < 60) return `${s}s`;
+ const m = Math.floor(s / 60);
+ if (m < 60) return `${m}m ${s % 60}s`;
+ const h = Math.floor(m / 60);
+ if (h < 24) return `${h}h ${m % 60}m`;
+ return `${Math.floor(h / 24)}d ${h % 24}h`;
+}
+
+// Log shows a short one-line log inline and folds anything longer, open when
it
+// explains a failure.
+function Log({ text, open }: { text: string | null | undefined; open?: boolean
}) {
+ if (!text) return null;
+ if (!text.includes("\n") && text.length <= 140) return <div className="small
muted log-line">{text}</div>;
+ return (
+ <details className="log" open={open}>
+ <summary>Log</summary>
+ <pre className="block">{text}</pre>
+ </details>
+ );
+}
export default function ProcessViewPage() {
return (
@@ -58,10 +125,22 @@ export default function ProcessViewPage() {
);
}
+type TabKey = "overview" | "activity" | "tasks" | "details";
+
+interface FeedEvent {
+ key: string;
+ ts: number | null;
+ source: string;
+ detail?: string;
+ status: string | null;
+ log?: string | null;
+}
+
function ProcessView() {
const id = useSearchParams().get("id") ?? "";
const names = useDeploymentNames();
const [live, setLive] = useState(true);
+ const [tab, setTab] = useState<TabKey>("overview");
const detail = useResource(
async () => {
const [process, statuses] = await Promise.all([
@@ -88,17 +167,58 @@ function ProcessView() {
);
const [error, setError] = useState<string | null>(null);
const [busy, setBusy] = useState(false);
+ const endpoints = useEndpoints(
+ detail.data?.tasks[STAGING] ?? null,
+ detail.data?.process.batchProcess?.slurmClusterConfigId,
+ );
if (!id) return <Alert>No process id given.</Alert>;
const d = detail.data;
const bp = d?.process.batchProcess;
const latest = d?.statuses[d.statuses.length - 1];
const template =
names.template(names.deployment(bp?.deploymentId)?.templateId);
+
// Statuses arrive oldest first, so the last one seen for a task is its
current one.
const latestTaskStatus = new Map<string, TaskStatus>();
for (const s of d?.taskStatuses ?? []) latestTaskStatus.set(s.taskId, s);
const taskOrder = new Map<string, number | null>();
d?.tasks.forEach((list) => list?.forEach((t) => taskOrder.set(t.taskId,
t.taskOrder)));
+ const allTasks = (d?.tasks ?? [])
+ .flatMap((list, i) => (list ?? []).map((t) => ({ task: t, kind:
TASK_KINDS[i] })))
+ .sort((a, b) => (a.task.taskOrder ?? Infinity) - (b.task.taskOrder ??
Infinity));
+
+ const feed: FeedEvent[] = d
+ ? [
+ ...d.statuses.map((s) => ({
+ key: `p-${s.processStatusId}`,
+ ts: s.timestamp,
+ source: "Process",
+ status: s.status,
+ log: s.log,
+ })),
+ ...(bp?.batchJobStatuses ?? []).map((s) => ({
+ key: `b-${s.batchProcessStatusId}`,
+ ts: s.updatedAt,
+ source: "Scheduler",
+ status: s.status,
+ })),
+ ...d.taskStatuses.map((s) => {
+ const order = taskOrder.get(s.taskId);
+ return {
+ key: `t-${s.taskStatusId}`,
+ ts: s.timestamp,
+ source: TASK_KINDS.find((k) => k.type === s.taskType)?.label ??
s.taskType,
+ detail: order !== undefined && order !== null ? `step ${order}` :
undefined,
+ status: s.status,
+ log: s.log,
+ };
+ }),
+ ].sort((a, b) => (a.ts ?? 0) - (b.ts ?? 0))
+ : [];
+
+ const started = d?.statuses[0]?.timestamp;
+ const ended = latest && TERMINAL.has(latest.status ?? "") ? latest.timestamp
: null;
+ const elapsed = started ? duration((ended ?? Date.now()) - started) : null;
const act = async (action: "launch" | "retry") => {
setBusy(true);
@@ -116,31 +236,32 @@ function ProcessView() {
return (
<div className="stack">
+ <div>
+ <Link href="/processes/" className="small muted">
+ ← All processes
+ </Link>
+ </div>
<PageHead
title={template?.templateName ? `${template.templateName} run` :
"Process"}
sub={
<span className="row">
- <code>{id}</code>
<StatusBadge status={latest?.status} />
+ <Id value={id} />
{live ? (
- <span className="small muted">
- <span className="dot ok" /> live, every {POLL_MS / 1000}s
+ <span className="small muted row live">
+ <span className="dot ok pulse" /> Live
</span>
) : (
- <span className="small muted">not refreshing</span>
+ <button className="link small" onClick={() => setLive(true)}
title="Poll for changes again">
+ Resume live updates
+ </button>
)}
</span>
}
>
- <Link href="/processes/" className="btn">
- All processes
- </Link>
- <button onClick={() => void detail.reload()} disabled={detail.loading}>
- Refresh
+ <button onClick={() => void detail.reload()} disabled={detail.loading}
title="Refresh now">
+ ↻ Refresh
</button>
- {!live && (
- <button onClick={() => setLive(true)}>Resume live updates</button>
- )}
{latest?.status === "CREATED" && (
<button className="primary" disabled={busy} onClick={() => void
act("launch")}>
{busy ? "Launching…" : "Launch"}
@@ -161,196 +282,526 @@ function ProcessView() {
{d && (
<>
- <div className="grid-stats">
- <div className="card stat">
- <div className="label">Process status</div>
- <div className="value">
- <StatusBadge status={latest?.status} />
+ <section className="card summary">
+ <dl className="facts">
+ <div>
+ <dt>Scheduler</dt>
+ <dd>
+ <StatusBadge status={bp?.latestBatchJobStatus?.status} />
+ </dd>
</div>
- </div>
- <div className="card stat">
- <div className="label">Scheduler status</div>
- <div className="value">
- <StatusBadge status={bp?.latestBatchJobStatus?.status} />
+ <div>
+ <dt>Job ID</dt>
+ <dd className="mono">{bp?.jobId ?? <span
className="muted">—</span>}</dd>
</div>
- </div>
- <div className="card stat">
- <div className="label">Slurm job ID</div>
- <div className="value mono">{bp?.jobId ?? "—"}</div>
- </div>
- <div className="card stat">
- <div className="label">Created</div>
- <div className="value
small">{formatTime(d.statuses[0]?.timestamp)}</div>
- </div>
- </div>
-
- <Card title="Status history">
- {d.statuses.length === 0 ? (
- <span className="muted">No statuses recorded.</span>
- ) : (
- <ul className="timeline">
- {d.statuses.map((s) => (
- <li key={s.processStatusId}>
- <span>
- <StatusBadge status={s.status} />
- </span>
- <span className="small
muted">{formatTime(s.timestamp)}</span>
- <span>{s.log ? <pre className="block">{s.log}</pre> :
<span className="muted">—</span>}</span>
- </li>
- ))}
- </ul>
+ <div>
+ <dt>Started</dt>
+ <dd>
+ <span title={formatTime(started)}>{shortTime(started)}</span>
+ </dd>
+ </div>
+ <div>
+ <dt>{ended ? "Duration" : "Elapsed"}</dt>
+ <dd>{elapsed ?? <span className="muted">—</span>}</dd>
+ </div>
+ <div>
+ <dt>Owner</dt>
+ <dd className="mono">{d.process.userId ?? <span
className="muted">—</span>}</dd>
+ </div>
+ </dl>
+ {d.workflows && d.workflows.length > 0 && (
+ <Stepper
+ workflows={d.workflows}
+ monitoring={[...latestTaskStatus.values()].filter((s) =>
s.taskType === "JOB_MONITORING").pop()}
+ />
)}
- {bp && bp.batchJobStatuses.length > 0 && (
- <>
- <h3 style={{ marginTop: 16 }}>Scheduler events</h3>
- <ul className="timeline">
- {bp.batchJobStatuses.map((s) => (
- <li key={s.batchProcessStatusId}>
- <span>
- <StatusBadge status={s.status} />
- </span>
- <span className="small
muted">{formatTime(s.updatedAt)}</span>
- <span />
+ </section>
+
+ <Tabs
+ value={tab}
+ onChange={setTab}
+ tabs={[
+ { key: "overview", label: "Overview" },
+ { key: "activity", label: <>Activity <span
className="count">{feed.length}</span></> },
+ ...(allTasks.length > 0
+ ? [{ key: "tasks" as const, label: <>Tasks <span
className="count">{allTasks.length}</span></> }]
+ : []),
+ { key: "details", label: "Details" },
+ ]}
+ />
+
+ {tab === "overview" && (
+ <>
+ {latest?.status === "FAILED" && latest.log && (
+ <div className="alert error">
+ <strong>This run failed.</strong>
+ <pre className="block failure">{latest.log}</pre>
+ </div>
+ )}
+ {bp ? (
+ <Mappings
+ inputs={bp.inputMappings.map((m) => {
+ const decl = template?.inputs.find((i) => i.inputId ===
m.templateInputId);
+ return { key: m.templateInputMappingId ??
m.templateInputId!, name: decl?.inputName, type: decl?.inputType, value:
m.value };
+ })}
+ outputs={bp.outputMappings.map((m) => {
+ const decl = template?.outputs.find((o) => o.outputId ===
m.templateOutputId);
+ return { key: m.templateOutputMappingId ??
m.templateOutputId!, name: decl?.outputName, type: decl?.outputType, value:
m.value };
+ })}
+ />
+ ) : (
+ <div className="empty">This process has no batch job.</div>
+ )}
+ </>
+ )}
+
+ {tab === "activity" && (
+ <Card flush>
+ {feed.length === 0 ? (
+ <div className="empty">Nothing recorded yet.</div>
+ ) : (
+ <ol className="feed">
+ {feed.map((e) => (
+ <li key={e.key}>
+ <span className={`feed-dot ${statusTone(e.status)}`} />
+ <div className="feed-body">
+ <div className="row">
+ <strong>{e.source}</strong>
+ {e.detail && <span className="small
muted">{e.detail}</span>}
+ <StatusBadge status={e.status} />
+ <span className="spacer" />
+ <Time ms={e.ts} />
+ </div>
+ <Log text={e.log} open={e.status === "FAILED"} />
+ </div>
</li>
))}
- </ul>
- </>
- )}
- </Card>
-
- {d.workflows && d.workflows.length > 0 && (
- <Card title="Workflows" flush>
- <Table
- rows={d.workflows}
- rowKey={(w) => w.processWorkflowId}
- empty=""
- columns={[
- {
- header: "Workflow",
- cell: (w) => (
- <span className="row">
- <strong>{w.workflowType ?
WORKFLOW_LABELS[w.workflowType] : "—"}</strong>
- {w.processWorkflowId === d.process.lastWorkflowId &&
<span className="small muted">latest</span>}
- </span>
- ),
- },
- { header: "Status", cell: (w) => <StatusBadge
status={w.status} /> },
- { header: "Started", cell: (w) => <span
className="small">{formatTime(w.timestamp)}</span> },
- { header: "Workflow ID", cell: (w) => <Id
value={w.workflowId} /> },
- ]}
- />
+ </ol>
+ )}
</Card>
)}
- {d.taskStatuses.length > 0 && (
- <Card title="Task history">
- <ul className="timeline">
- {d.taskStatuses.map((s) => {
- const order = taskOrder.get(s.taskId);
+ {tab === "tasks" && (
+ <Card flush>
+ <div className="task-list">
+ {allTasks.map(({ task, kind }) => {
+ const st = latestTaskStatus.get(task.taskId);
+ const staging = kind.type === "DATA_STAGING";
+ const submission = kind.type === "JOB_SUBMISSION";
+ const shown = staging ? STAGING_FIELDS : submission ?
SUBMISSION_FIELDS : null;
+ const extra = Object.keys(task).filter((f) =>
!COMMON_TASK_FIELDS.has(f) && !shown?.has(f));
+ const cluster = bp?.slurmClusterConfigId;
return (
- <li key={s.taskStatusId}>
- <span>
- <StatusBadge status={s.status} />
- </span>
- <span className="small
muted">{formatTime(s.timestamp)}</span>
- <span>
- <span className="row">
- <strong>{TASK_KINDS.find((k) => k.type ===
s.taskType)?.label ?? s.taskType}</strong>
- {order !== undefined && order !== null && <span
className="small muted">step {order}</span>}
- <Id value={s.taskId} />
- </span>
- {s.log && <pre className="block">{s.log}</pre>}
- </span>
- </li>
+ <details key={task.taskId} className="task"
open={st?.status === "FAILED"}>
+ <summary>
+ <span className="step">{task.taskOrder ?? "·"}</span>
+ <strong>{kind.label}</strong>
+ <StatusBadge status={st?.status} />
+ {staging && <span className="small muted
route">{routeLabel(task, endpoints)}</span>}
+ {submission && cluster && (
+ <span className="small muted route">
+ → {endpoints.get(endpointKey("HPC",
cluster))?.name ?? "cluster"}
+ {typeof task.jobId === "string" && task.jobId && `
· job ${task.jobId}`}
+ </span>
+ )}
+ <span className="spacer" />
+ <Time ms={st?.timestamp} />
+ </summary>
+ <div className="task-body">
+ {staging && <Transfer task={task}
endpoints={endpoints} />}
+ {submission && (
+ <SubmittedTo
+ task={task}
+ clusterConfigId={cluster}
+ endpoint={cluster ?
endpoints.get(endpointKey("HPC", cluster)) : undefined}
+ allocation={bp?.batchJobConfig?.allocation}
+ />
+ )}
+ <dl className="kv">
+ {extra.map((f) => (
+ <FieldRow key={f} name={f} value={task[f]} />
+ ))}
+ <dt>On failure</dt>
+ <dd>{task.onFailure ?? <span
className="muted">—</span>}</dd>
+ {task.retryCount ? (
+ <>
+ <dt>Retries</dt>
+ <dd>{task.retryCount}</dd>
+ </>
+ ) : null}
+ <dt>Task ID</dt>
+ <dd>
+ <code>{task.taskId}</code>
+ </dd>
+ </dl>
+ {kind.type === "JOB_SUBMISSION" && <JobScript
script={task.script} />}
+ <Log text={st?.log} open={st?.status === "FAILED"} />
+ </div>
+ </details>
);
})}
- </ul>
+ </div>
</Card>
)}
- {bp && (
- <Card title="Run">
- <dl className="kv">
- <dt>Owner</dt>
- <dd>
- <code>{d.process.userId}</code>
- </dd>
- <dt>Deployment</dt>
- <dd>
- <Id value={bp.deploymentId} />
- </dd>
- <dt>Cluster config</dt>
- <dd>
- <Id value={bp.slurmClusterConfigId} />
- </dd>
- <dt>Base work dir</dt>
- <dd>
- <code>{bp.baseWorkDir ?? "(cluster config work root)"}</code>
- </dd>
- <dt>Resources</dt>
- <dd>
- <code>
- {Object.entries(bp.batchJobConfig ?? {})
- .filter(([k, v]) => k !== "batchJobConfigId" && v !==
null && v !== undefined)
- .map(([k, v]) => `${k}=${v}`)
- .join(" ")}
- </code>
- </dd>
- </dl>
- </Card>
+ {tab === "details" && (
+ <>
+ {bp && (
+ <Card title="Run configuration">
+ <dl className="kv">
+ <dt>Deployment</dt>
+ <dd>
+ <Id value={bp.deploymentId} />
+ </dd>
+ <dt>Cluster config</dt>
+ <dd>
+ <Id value={bp.slurmClusterConfigId} />
+ </dd>
+ <dt>Base work dir</dt>
+ <dd>
+ {bp.baseWorkDir ? <code>{bp.baseWorkDir}</code> : <span
className="muted">Cluster config work root</span>}
+ </dd>
+ <dt>Resources</dt>
+ <dd className="chips">
+ {Object.entries(bp.batchJobConfig ?? {})
+ .filter(([k, v]) => k !== "batchJobConfigId" && v !==
null && v !== undefined && v !== "")
+ .map(([k, v]) => (
+ <span key={k} className="chip">
+ <span className="muted">{RESOURCE_LABELS[k] ??
k}</span> {String(v)}
+ </span>
+ ))}
+ </dd>
+ </dl>
+ </Card>
+ )}
+ {d.workflows && d.workflows.length > 0 && (
+ <Card title="Workflow runs" flush>
+ <Table
+ rows={d.workflows}
+ rowKey={(w) => w.processWorkflowId}
+ empty=""
+ columns={[
+ {
+ header: "Workflow",
+ cell: (w) => (
+ <span className="row">
+ {w.workflowType ? WORKFLOW_LABELS[w.workflowType]
: "—"}
+ {w.processWorkflowId === d.process.lastWorkflowId
&& <span className="badge">latest</span>}
+ </span>
+ ),
+ },
+ { header: "Status", cell: (w) => <StatusBadge
status={w.status} /> },
+ { header: "Started", cell: (w) => <Time ms={w.timestamp}
/> },
+ { header: "Workflow ID", cell: (w) => <Id
value={w.workflowId} /> },
+ ]}
+ />
+ </Card>
+ )}
+ </>
)}
+ </>
+ )}
+ </div>
+ );
+}
+
+// A data staging endpoint, resolved from the storage id and type a task
names. An SCP
+// endpoint is a registered storage; an HPC endpoint is a cluster config,
reached
+// through the cluster's head node.
+interface Endpoint {
+ kind: "SCP" | "HPC";
+ name: string;
+ address: string;
+}
+
+// The staging fields Transfer shows; they are kept out of the generic field
list.
+const STAGING_FIELDS = new Set([
+ "sourceDataStorageId",
+ "sourceDataStorageType",
+ "sourcePath",
+ "destinationDataStorageId",
+ "destinationDataStorageType",
+ "destinationPath",
+]);
- {bp && (
- <Mappings
- inputs={bp.inputMappings.map((m) => {
- const decl = template?.inputs.find((i) => i.inputId ===
m.templateInputId);
- return { key: m.templateInputMappingId ?? m.templateInputId!,
name: decl?.inputName, type: decl?.inputType, value: m.value };
- })}
- outputs={bp.outputMappings.map((m) => {
- const decl = template?.outputs.find((o) => o.outputId ===
m.templateOutputId);
- return { key: m.templateOutputMappingId ??
m.templateOutputId!, name: decl?.outputName, type: decl?.outputType, value:
m.value };
- })}
- />
+// The submission fields SubmittedTo shows (script has its own block).
+const SUBMISSION_FIELDS = new Set(["jobId", "workingDir"]);
+
+const endpointKey = (type: unknown, id: unknown) =>
`${String(type)}:${String(id)}`;
+
+// EndpointName names an endpoint, or says why it cannot: undefined while it
loads or
+// when there is no id, null when the viewer may not read it.
+function EndpointName({ endpoint, id }: { endpoint: Endpoint | null |
undefined; id: unknown }) {
+ if (endpoint)
+ return (
+ <>
+ <strong>{endpoint.name}</strong>
+ {endpoint.address && <code className="small
muted">{endpoint.address}</code>}
+ </>
+ );
+ if (endpoint === null)
+ return (
+ <span className="small muted">
+ Not visible to you · <Id value={String(id)} />
+ </span>
+ );
+ return id ? <Id value={String(id)} /> : <span className="muted">—</span>;
+}
+
+// SubmittedTo shows where a submission task sends its job: the run's cluster,
reached
+// through its head node, the directory the job is submitted from, and the job
id the
+// scheduler gave it.
+function SubmittedTo({
+ task,
+ clusterConfigId,
+ endpoint,
+ allocation,
+}: {
+ task: Task;
+ clusterConfigId: string | null | undefined;
+ endpoint: Endpoint | null | undefined;
+ allocation: string | null | undefined;
+}) {
+ const jobId = typeof task.jobId === "string" && task.jobId ? task.jobId :
null;
+ const workingDir = typeof task.workingDir === "string" && task.workingDir ?
task.workingDir : null;
+ return (
+ <div className="endpoint">
+ <div className="endpoint-label">Submitted to</div>
+ <div className="endpoint-body">
+ <div className="row">
+ <span className="badge">Cluster</span>
+ <EndpointName endpoint={endpoint} id={clusterConfigId} />
+ </div>
+ <dl className="kv small">
+ <dt>Working dir</dt>
+ <dd>{workingDir ? <code>{workingDir}</code> : <span
className="muted">—</span>}</dd>
+ {allocation && (
+ <>
+ <dt>Allocation</dt>
+ <dd>
+ <code>{allocation}</code>
+ </dd>
+ </>
)}
+ <dt>Job ID</dt>
+ <dd>{jobId ? <code>{jobId}</code> : <span className="muted">Not
submitted yet</span>}</dd>
+ </dl>
+ </div>
+ </div>
+ );
+}
- {TASK_KINDS.map((k, i) => {
- const tasks = d.tasks[i];
- if (!tasks || tasks.length === 0) return null;
- const extra = Array.from(new Set(tasks.flatMap((t) =>
Object.keys(t)))).filter((f) => !COMMON_TASK_FIELDS.has(f));
- return (
- <Card key={k.path} title={`${k.label} tasks`} flush>
- <Table
- rows={tasks}
- rowKey={(t) => t.taskId}
- empty=""
- columns={[
- { header: "Order", cell: (t) => t.taskOrder ?? "—" },
- { header: "Status", cell: (t) => <StatusBadge
status={latestTaskStatus.get(t.taskId)?.status} /> },
- {
- header: "Updated",
- cell: (t) => <span
className="small">{formatTime(latestTaskStatus.get(t.taskId)?.timestamp)}</span>,
- },
- ...extra.map((f) => ({
- header: f,
- cell: (t: Task) => {
- const v = t[f];
- if (v === null || v === undefined || v === "") return
<span className="muted">—</span>;
- const text = String(v);
- return text.includes("\n") ? <pre
className="block">{text}</pre> : <code>{text}</code>;
- },
- })),
- { header: "On failure", cell: (t) => t.onFailure ?? "—" },
- ]}
- />
- </Card>
+function address(user: string | null | undefined, host: string | null |
undefined, port: number | null | undefined) {
+ if (!host) return "";
+ return `${user ? `${user}@` : ""}${host}${port && port !== 22 ? `:${port}` :
""}`;
+}
+
+// useEndpoints looks up every endpoint the staging tasks name. One the viewer
cannot
+// read (it belongs to someone else and is not shared) resolves to null.
+// clusterConfigId is the cluster the job is submitted to, looked up alongside
them.
+function useEndpoints(tasks: Task[] | null, clusterConfigId: string | null |
undefined): Map<string, Endpoint | null> {
+ const refs = new Map<string, { type: string; id: string }>();
+ if (clusterConfigId) refs.set(endpointKey("HPC", clusterConfigId), { type:
"HPC", id: clusterConfigId });
+ for (const t of tasks ?? []) {
+ for (const [type, id] of [
+ [t.sourceDataStorageType, t.sourceDataStorageId],
+ [t.destinationDataStorageType, t.destinationDataStorageId],
+ ]) {
+ if (typeof type === "string" && typeof id === "string")
refs.set(endpointKey(type, id), { type, id });
+ }
+ }
+ const keys = [...refs.keys()].sort().join(",");
+ const res = useResource(async () => {
+ const out = new Map<string, Endpoint | null>();
+ await Promise.all(
+ [...refs.entries()].map(async ([key, { type, id }]) => {
+ try {
+ if (type === "HPC") {
+ const c = await
tryGet<SlurmClusterConfig>(`/api/v1/slurm-cluster-configs/${id}`);
+ out.set(
+ key,
+ c && {
+ kind: "HPC",
+ name: c.name || c.slurmCluster?.clusterName || "Cluster",
+ address: address(c.loginUser, c.slurmCluster?.headnodeHost,
c.slurmCluster?.headnodePort),
+ },
);
- })}
- </>
- )}
+ } else {
+ const s = await
tryGet<SCPDataStorage>(`/api/v1/scp-data-storages/${id}`);
+ out.set(key, s && { kind: "SCP", name: s.dataName || "Storage",
address: address(s.loginUser, s.hostName, s.port) });
+ }
+ } catch {
+ out.set(key, null);
+ }
+ }),
+ );
+ return out;
+ }, [keys]);
+ return res.data ?? new Map();
+}
+
+// Paths are a single path or a JSON array of them.
+function paths(v: unknown): string[] {
+ if (typeof v !== "string" || v === "") return [];
+ if (v.trim().startsWith("[")) {
+ try {
+ const list = JSON.parse(v);
+ if (Array.isArray(list)) return list.map(String);
+ } catch {
+ // Not JSON; a single path.
+ }
+ }
+ return [v];
+}
+
+function routeLabel(task: Task, endpoints: Map<string, Endpoint | null>):
string {
+ const name = (type: unknown, id: unknown) =>
+ id ? (endpoints.get(endpointKey(type, id))?.name ?? (type === "HPC" ?
"cluster" : "storage")) : "?";
+ return `${name(task.sourceDataStorageType, task.sourceDataStorageId)} →
${name(task.destinationDataStorageType, task.destinationDataStorageId)}`;
+}
+
+function Transfer({ task, endpoints }: { task: Task; endpoints: Map<string,
Endpoint | null> }) {
+ const side = (label: string, type: unknown, id: unknown, path: unknown) => {
+ const ep = id ? endpoints.get(endpointKey(type, id)) : undefined;
+ const list = paths(path);
+ return (
+ <div className="endpoint">
+ <div className="endpoint-label">{label}</div>
+ <div className="endpoint-body">
+ <div className="row">
+ <span className="badge">{type === "HPC" ? "Cluster" : String(type
?? "?")}</span>
+ <EndpointName endpoint={ep} id={id} />
+ </div>
+ {list.length === 0 ? (
+ <span className="small muted">No path</span>
+ ) : (
+ list.map((p) => (
+ <code key={p} className="endpoint-path">
+ {p}
+ </code>
+ ))
+ )}
+ </div>
+ </div>
+ );
+ };
+ return (
+ <div className="transfer">
+ {side("From", task.sourceDataStorageType, task.sourceDataStorageId,
task.sourcePath)}
+ <div className="transfer-arrow" aria-hidden>
+ →
+ </div>
+ {side("To", task.destinationDataStorageType,
task.destinationDataStorageId, task.destinationPath)}
</div>
);
}
+// JobScript shows the batch script a submission task built, which the server
records
+// when the task runs.
+function JobScript({ script }: { script: unknown }) {
+ const [copied, setCopied] = useState(false);
+ if (typeof script !== "string" || script === "") {
+ return <div className="small muted">The job script is recorded when this
task runs.</div>;
+ }
+ return (
+ <div className="script">
+ <div className="script-head">
+ <span className="small">
+ <strong>Job script</strong> <span className="muted">·
script.slurm</span>
+ </span>
+ <span className="spacer" />
+ <button
+ className="small"
+ onClick={async () => {
+ try {
+ await navigator.clipboard.writeText(script);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 1500);
+ } catch {
+ // Clipboard unavailable (e.g. insecure context); the text is
selectable.
+ }
+ }}
+ >
+ {copied ? "Copied" : "Copy"}
+ </button>
+ </div>
+ <pre className="block">{script}</pre>
+ </div>
+ );
+}
+
+function FieldRow({ name, value }: { name: string; value: unknown }) {
+ const empty = value === null || value === undefined || value === "";
+ const text = empty ? "" : typeof value === "object" ? JSON.stringify(value,
null, 2) : String(value);
+ return (
+ <>
+ <dt>{name}</dt>
+ <dd>
+ {empty ? (
+ <span className="muted">—</span>
+ ) : text.includes("\n") ? (
+ <pre className="block">{text}</pre>
+ ) : (
+ <code>{text}</code>
+ )}
+ </dd>
+ </>
+ );
+}
+
+type StepState = "done" | "running" | "failed" | "pending";
+
+const WORKFLOW_STATE: Record<string, StepState> = { SUCCEEDED: "done",
RUNNING: "running", FAILED: "failed" };
+const TASK_STATE: Record<string, StepState> = {
+ COMPLETED: "done",
+ EXECUTING: "running",
+ PAUSED: "running",
+ FAILED: "failed",
+ CANCELED: "failed",
+};
+
+// Stepper shows where the run is: submission and completion by the latest run
of
+// their workflows, and monitoring by its task, since the server runs job
monitoring
+// as a task inside the completion workflow rather than as a workflow of its
own.
+function Stepper({ workflows, monitoring }: { workflows: ProcessWorkflow[];
monitoring: TaskStatus | undefined }) {
+ const latest = new Map<ProcessWorkflowType, { w: ProcessWorkflow; attempts:
number }>();
+ for (const w of workflows) {
+ if (!w.workflowType) continue;
+ latest.set(w.workflowType, { w, attempts:
(latest.get(w.workflowType)?.attempts ?? 0) + 1 });
+ }
+ return (
+ <ol className="stepper">
+ {WORKFLOW_STEPS.map((s, i) => {
+ let state: StepState;
+ let text: string;
+ let attempts = 0;
+ if (s.type === "JOB_MONITORING") {
+ state = TASK_STATE[monitoring?.status ?? ""] ?? "pending";
+ text = state === "done" ? "completed" : state === "running" ?
"watching job" : (monitoring?.status ?? "pending").toLowerCase();
+ } else {
+ const run = latest.get(s.type);
+ state = WORKFLOW_STATE[run?.w.status ?? ""] ?? "pending";
+ text = run ? (run.w.status ?? "—").toLowerCase() : "pending";
+ attempts = run?.attempts ?? 0;
+ }
+ if (state === "pending") text = "pending";
+ return (
+ <li key={s.type} className={state}>
+ <span className="marker">{state === "done" ? "✓" : state ===
"failed" ? "!" : i + 1}</span>
+ <span className="step-text">
+ <span className="step-label">{s.label}</span>
+ <span className="small muted">
+ {text}
+ {attempts > 1 && ` · attempt ${attempts}`}
+ </span>
+ </span>
+ </li>
+ );
+ })}
+ </ol>
+ );
+}
+
interface MappingRow {
key: string;
name: string | undefined;
@@ -385,27 +836,37 @@ function Mappings({ inputs, outputs }: { inputs:
MappingRow[]; outputs: MappingR
const p = products.data?.get(m.value);
if (!p) return <Id value={m.value} />;
return (
- <span className="row">
- <span>
- <strong>{p.dataName}</strong> <code className="small">{p.path}</code>
- </span>
- <StatusBadge status={p.provisionStatus} />
- {p.isFile && (
- <button
- className="small"
- onClick={async () => {
- setError(null);
- try {
- await
api.download(`/api/v1/data-products/${p.dataId}/content`,
p.path?.split("/").pop() || p.dataId);
- } catch (e) {
- setError(errorText(e));
- }
- }}
- >
- Download
- </button>
+ <div className="product">
+ <div className="row">
+ <strong>{p.dataName}</strong>
+ {p.provisionStatus !== "PROVISIONED" && <StatusBadge
status={p.provisionStatus} />}
+ </div>
+ {p.path && (
+ <code className="small muted truncate" title={p.path}>
+ {p.path}
+ </code>
)}
- </span>
+ </div>
+ );
+ };
+
+ const download = (m: MappingRow) => {
+ const p = m.value ? products.data?.get(m.value) : undefined;
+ if (!p?.isFile) return null;
+ return (
+ <button
+ className="small"
+ onClick={async () => {
+ setError(null);
+ try {
+ await api.download(`/api/v1/data-products/${p.dataId}/content`,
p.path?.split("/").pop() || p.dataId);
+ } catch (e) {
+ setError(errorText(e));
+ }
+ }}
+ >
+ Download
+ </button>
);
};
@@ -415,9 +876,17 @@ function Mappings({ inputs, outputs }: { inputs:
MappingRow[]; outputs: MappingR
rowKey={(m) => m.key}
empty={empty}
columns={[
- { header: "Name", cell: (m) => <code>{m.name ?? "?"}</code> },
- { header: "Type", cell: (m) => <span className="badge">{m.type ??
"?"}</span> },
+ {
+ header: "Name",
+ cell: (m) => (
+ <span className="row">
+ <strong>{m.name ?? "?"}</strong>
+ <span className="small muted">{(m.type ??
"?").toLowerCase()}</span>
+ </span>
+ ),
+ },
{ header: "Value", cell: render },
+ { header: "", className: "actions", cell: download },
]}
/>
);
@@ -425,12 +894,14 @@ function Mappings({ inputs, outputs }: { inputs:
MappingRow[]; outputs: MappingR
return (
<>
<Alert>{error}</Alert>
- <Card title="Inputs" flush>
- {table(inputs, "No inputs.")}
- </Card>
- <Card title="Outputs" flush>
- {table(outputs, "No outputs.")}
- </Card>
+ <div className="io-grid">
+ <Card title="Inputs" flush>
+ {table(inputs, "No inputs.")}
+ </Card>
+ <Card title="Outputs" flush>
+ {table(outputs, "No outputs.")}
+ </Card>
+ </div>
</>
);
}
diff --git a/dashboard/src/components/ui.tsx b/dashboard/src/components/ui.tsx
index 54b937e85a..a4f41311db 100644
--- a/dashboard/src/components/ui.tsx
+++ b/dashboard/src/components/ui.tsx
@@ -243,9 +243,14 @@ const STATUS_TONE: Record<string, string> = {
SUSPENDED: "danger",
};
+// statusTone names the colour family for a status: ok, info, warn, danger, or
"".
+export function statusTone(status: string | null | undefined): string {
+ return (status && STATUS_TONE[status]) || "";
+}
+
export function StatusBadge({ status }: { status: string | null | undefined })
{
if (!status) return <span className="badge">—</span>;
- return <span className={`badge ${STATUS_TONE[status] ??
""}`}>{status}</span>;
+ return <span className={`badge ${statusTone(status)}`}>{status}</span>;
}
export function Id({ value }: { value: string | null | undefined }) {
diff --git a/docs/api.md b/docs/api.md
index 62ea624e59..63f3e45234 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -2216,6 +2216,8 @@ Both take the shared fields plus an optional `jobId`, and
a submission task take
`workingDir` is filled in by [launching the process](#launch-a-process), which
sets it to the run's work directory, and a task created there carries it
without the caller supplying anything. It is writable so that a submission task
recorded by hand can name one too: a task that reaches submission without a
working directory is refused rather than submitted from the login user's home,
since that is not where its inputs were staged.
+A submission task's response also carries `script`: the batch script the task
built and submitted. The server sets it and it cannot be written. It is `null`
until the task first runs, is recorded before the script is submitted (so it is
there to inspect even when submission fails), and is replaced each time a
[retry](#retry-a-process) runs the task again.
+
```bash
curl -s -X PUT
localhost:9095/api/v1/processes/"$PROCESS_ID"/job-submission-tasks/"$TASK_ID" \
-H "Authorization: Bearer $TOKEN" \
@@ -2231,6 +2233,7 @@ curl -s -X PUT
localhost:9095/api/v1/processes/"$PROCESS_ID"/job-submission-task
"processId": "a1b2c3d4-e5f6-4708-9a1b-2c3d4e5f6a7b",
"jobId": "4821577",
"workingDir": "/scratch/alphafold/a1b2c3d4-e5f6-4708-9a1b-2c3d4e5f6a7b",
+ "script": null,
"onFailure": "EXIT",
"retryCount": 1,
"taskOrder": 1
diff --git a/docs/openapi.yaml b/docs/openapi.yaml
index f372c7f901..ff58b63547 100644
--- a/docs/openapi.yaml
+++ b/docs/openapi.yaml
@@ -4067,6 +4067,11 @@ components:
processId: { type: [string, "null"], format: uuid }
jobId: { type: [string, "null"] }
workingDir: { type: [string, "null"] }
+ script:
+ type: [string, "null"]
+ description: |
+ The batch script the task last built and submitted. Server-set and
+ read-only: null until the task first runs, replaced on each retry.
onFailure:
oneOf:
- { $ref: "#/components/schemas/OnFailureAction" }
diff --git a/internal/db/migrations/0009_job_submission_script.sql
b/internal/db/migrations/0009_job_submission_script.sql
new file mode 100644
index 0000000000..2d7c9a5108
--- /dev/null
+++ b/internal/db/migrations/0009_job_submission_script.sql
@@ -0,0 +1,6 @@
+-- Record the batch script a job submission task built and submitted, so a run
can be
+-- inspected afterwards. Tasks that ran before this column existed are left
NULL — their
+-- script was never kept. The DDL is what AutoMigrate emits for
+-- JobSubmissionTask.Script — see TestBaselineMigrationMatchesAutoMigrate.
+
+ALTER TABLE "job_submission_tasks" ADD COLUMN "script" text;
diff --git a/internal/mcp/client/client.gen.go
b/internal/mcp/client/client.gen.go
index 56da9fc5a1..4e09758ab2 100644
--- a/internal/mcp/client/client.gen.go
+++ b/internal/mcp/client/client.gen.go
@@ -954,9 +954,13 @@ type JobSubmissionTaskResponse struct {
OnFailure *OnFailureAction `json:"onFailure,omitempty"`
ProcessId *openapi_types.UUID `json:"processId,omitempty"`
RetryCount *int `json:"retryCount,omitempty"`
- TaskId openapi_types.UUID `json:"taskId"`
- TaskOrder *int `json:"taskOrder,omitempty"`
- WorkingDir *string `json:"workingDir,omitempty"`
+
+ // Script The batch script the task last built and submitted.
Server-set and
+ // read-only: null until the task first runs, replaced on each retry.
+ Script *string `json:"script,omitempty"`
+ TaskId openapi_types.UUID `json:"taskId"`
+ TaskOrder *int `json:"taskOrder,omitempty"`
+ WorkingDir *string `json:"workingDir,omitempty"`
}
// OnFailureAction defines model for OnFailureAction.
diff --git a/internal/orchestration/tasks/batch/batch.go
b/internal/orchestration/tasks/batch/batch.go
index 89d51ac3b5..f2a5dd23dc 100644
--- a/internal/orchestration/tasks/batch/batch.go
+++ b/internal/orchestration/tasks/batch/batch.go
@@ -112,6 +112,14 @@ func (a *Tasks) submitBatchJob(ctx context.Context,
executionContext *execution.
slog.Info("Built slurm script for batch job", "taskId", taskID,
"processId", processID, "script", script)
+ // Recorded before submitting, so the script can be inspected even when
the
+ // submission fails. A retry builds and records it afresh.
+ jst.Script = &script
+ if err := a.jobSubmissionTasks.Save(ctx, jst); err != nil {
+ slog.Error("Failed to record slurm script on job submission
task", "taskId", taskID, "processId", processID, "error", err)
+ return nil, err
+ }
+
// save script to a temporary location or a known path before uploading
scriptPath := fmt.Sprintf("/tmp/%s.slurm", processID)
err = os.WriteFile(scriptPath, []byte(script), 0644)