mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-04-05 21:36:48 +00:00
fix: consolidate DagTask types, fix REST fallback shape, fix lint noqa
- Extract shared DagTask/DagTaskStatus types into www/app/lib/dagTypes.ts
- Re-export from useWebSockets.ts and UserEventsProvider.tsx
- Fix browse page REST fallback: dag_status is list[dict] directly, not {tasks: [...]}
- Add missing # noqa: PLC0415 for fork-safe deferred imports
This commit is contained in:
@@ -125,7 +125,7 @@ def extract_dag_tasks(details: V1WorkflowRunDetails) -> list[DagTask]:
|
||||
parents_by_step[child_id].append(step_to_name[s.step_id])
|
||||
|
||||
# Join tasks by step_id
|
||||
from hatchet_sdk.clients.rest.models import V1TaskSummary
|
||||
from hatchet_sdk.clients.rest.models import V1TaskSummary # noqa: PLC0415
|
||||
|
||||
task_by_step: dict[str, V1TaskSummary] = {}
|
||||
for t in tasks:
|
||||
@@ -199,9 +199,9 @@ async def broadcast_dag_status(transcript_id: str, workflow_run_id: str) -> None
|
||||
from reflector.db.transcripts import transcripts_controller # noqa: I001, PLC0415
|
||||
from reflector.hatchet.broadcast import append_event_and_broadcast # noqa: PLC0415
|
||||
from reflector.hatchet.client import HatchetClientManager # noqa: PLC0415
|
||||
from reflector.hatchet.workflows.daily_multitrack_pipeline import (
|
||||
from reflector.hatchet.workflows.daily_multitrack_pipeline import ( # noqa: PLC0415
|
||||
fresh_db_connection,
|
||||
) # noqa: PLC0415
|
||||
)
|
||||
from reflector.logger import logger # noqa: PLC0415
|
||||
|
||||
async with fresh_db_connection():
|
||||
|
||||
@@ -145,11 +145,9 @@ function TranscriptCard({
|
||||
status={result.status}
|
||||
dagStatus={
|
||||
dagStatusMap?.get(result.id) ??
|
||||
(
|
||||
(result as Record<string, unknown>).dag_status as
|
||||
| { tasks?: DagTask[] }
|
||||
| undefined
|
||||
)?.tasks ??
|
||||
((result as Record<string, unknown>).dag_status as
|
||||
| DagTask[]
|
||||
| null) ??
|
||||
null
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -14,25 +14,8 @@ import {
|
||||
} from "../../lib/apiHooks";
|
||||
import { NonEmptyString } from "../../lib/utils";
|
||||
|
||||
export type DagTaskStatus =
|
||||
| "queued"
|
||||
| "running"
|
||||
| "completed"
|
||||
| "failed"
|
||||
| "cancelled";
|
||||
|
||||
export type DagTask = {
|
||||
name: string;
|
||||
status: DagTaskStatus;
|
||||
started_at: string | null;
|
||||
finished_at: string | null;
|
||||
duration_seconds: number | null;
|
||||
parents: string[];
|
||||
error: string | null;
|
||||
children_total: number | null;
|
||||
children_completed: number | null;
|
||||
progress_pct: number | null;
|
||||
};
|
||||
import type { DagTask } from "../../lib/dagTypes";
|
||||
export type { DagTask, DagTaskStatus } from "../../lib/dagTypes";
|
||||
|
||||
export type UseWebSockets = {
|
||||
transcriptTextLive: string;
|
||||
|
||||
@@ -7,25 +7,8 @@ import { useAuth } from "./AuthProvider";
|
||||
import { z } from "zod";
|
||||
import { invalidateTranscriptLists, TRANSCRIPT_SEARCH_URL } from "./apiHooks";
|
||||
|
||||
export type DagTaskStatus =
|
||||
| "queued"
|
||||
| "running"
|
||||
| "completed"
|
||||
| "failed"
|
||||
| "cancelled";
|
||||
|
||||
export type DagTask = {
|
||||
name: string;
|
||||
status: DagTaskStatus;
|
||||
started_at: string | null;
|
||||
finished_at: string | null;
|
||||
duration_seconds: number | null;
|
||||
parents: string[];
|
||||
error: string | null;
|
||||
children_total: number | null;
|
||||
children_completed: number | null;
|
||||
progress_pct: number | null;
|
||||
};
|
||||
import type { DagTask } from "./dagTypes";
|
||||
export type { DagTask, DagTaskStatus } from "./dagTypes";
|
||||
|
||||
const DagStatusContext = React.createContext<Map<string, DagTask[]>>(new Map());
|
||||
|
||||
|
||||
19
www/app/lib/dagTypes.ts
Normal file
19
www/app/lib/dagTypes.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export type DagTaskStatus =
|
||||
| "queued"
|
||||
| "running"
|
||||
| "completed"
|
||||
| "failed"
|
||||
| "cancelled";
|
||||
|
||||
export type DagTask = {
|
||||
name: string;
|
||||
status: DagTaskStatus;
|
||||
started_at: string | null;
|
||||
finished_at: string | null;
|
||||
duration_seconds: number | null;
|
||||
parents: string[];
|
||||
error: string | null;
|
||||
children_total: number | null;
|
||||
children_completed: number | null;
|
||||
progress_pct: number | null;
|
||||
};
|
||||
Reference in New Issue
Block a user