diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ae20b4e..ff4e3c95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - LogsModal now use a key so we can use logs not linked with a compute task (#270) - Replace `function.function` by `function.archive` (#296) +- Update task statuses to reflect the updates in the backend (#297) ## [0.46.0] - 2023-10-18 diff --git a/src/components/ComputePlanProgressBar.tsx b/src/components/ComputePlanProgressBar.tsx index c454b401..12d2f0a1 100644 --- a/src/components/ComputePlanProgressBar.tsx +++ b/src/components/ComputePlanProgressBar.tsx @@ -42,7 +42,11 @@ const ComputePlanProgressBar = ({ alignItems="stretch" > {!computePlan.task_count && ( - + )} {taskStatusOrder.map((status) => ( { {[ ComputePlanStatus.todo, ComputePlanStatus.waiting, - TaskStatus.todo, - TaskStatus.waiting, + TaskStatus.waitingBuilderSlot, ].includes(asset.status) ? 'Not started yet' : 'Information not available'} diff --git a/src/libs/status.ts b/src/libs/status.ts index 6212a702..9c4957d0 100644 --- a/src/libs/status.ts +++ b/src/libs/status.ts @@ -34,8 +34,10 @@ enum TaskStatusLabel { doing = 'Doing', done = 'Done', failed = 'Failed', - todo = 'Todo', - waiting = 'Waiting', + waitingParentTasks = 'Waiting parents', + waitingExecutorSlot = 'Waiting executor slot', + waitingBuilderSlot = 'Waiting builder slot', + building = 'Building', } const statusLabelByTaskStatus: Record = { @@ -43,8 +45,10 @@ const statusLabelByTaskStatus: Record = { [TaskStatus.doing]: TaskStatusLabel.doing, [TaskStatus.done]: TaskStatusLabel.done, [TaskStatus.failed]: TaskStatusLabel.failed, - [TaskStatus.todo]: TaskStatusLabel.todo, - [TaskStatus.waiting]: TaskStatusLabel.waiting, + [TaskStatus.waitingParentTasks]: TaskStatusLabel.waitingParentTasks, + [TaskStatus.waitingExecutorSlot]: TaskStatusLabel.waitingExecutorSlot, + [TaskStatus.waitingBuilderSlot]: TaskStatusLabel.waitingBuilderSlot, + [TaskStatus.building]: TaskStatusLabel.building, }; const statusLabelByComputePlanStatus: Record< @@ -117,9 +121,10 @@ export const getStatusStyle = ( progressColor: 'gray.500', }; - case TaskStatus.waiting: + case TaskStatus.waitingBuilderSlot: + case TaskStatus.waitingParentTasks: + case TaskStatus.waitingExecutorSlot: case ComputePlanStatus.waiting: - case TaskStatus.todo: case ComputePlanStatus.todo: return { icon: RiTimeLine, @@ -130,6 +135,7 @@ export const getStatusStyle = ( progressColor: 'gray.300', }; case TaskStatus.doing: + case TaskStatus.building: case ComputePlanStatus.doing: return { icon: RiPlayMiniLine, diff --git a/src/routes/computePlanDetails/ComputePlanUtils.ts b/src/routes/computePlanDetails/ComputePlanUtils.ts index 87085141..9ed50d77 100644 --- a/src/routes/computePlanDetails/ComputePlanUtils.ts +++ b/src/routes/computePlanDetails/ComputePlanUtils.ts @@ -13,10 +13,14 @@ export const getStatusCount = ( return computePlan.canceled_count; } else if (status === TaskStatus.failed) { return computePlan.failed_count; - } else if (status === TaskStatus.todo) { - return computePlan.todo_count; - } else if (status === TaskStatus.waiting) { - return computePlan.waiting_count; + } else if (status === TaskStatus.waitingParentTasks) { + return computePlan.waiting_parent_tasks_count; + } else if (status === TaskStatus.waitingExecutorSlot) { + return computePlan.waiting_executor_slot_count; + } else if (status === TaskStatus.waitingBuilderSlot) { + return computePlan.waiting_builder_slot_count; + } else if (status === TaskStatus.building) { + return computePlan.building_count; } throw `Invalid status ${status}`; diff --git a/src/routes/computePlanDetails/workflow/CPWorkflowUtils.ts b/src/routes/computePlanDetails/workflow/CPWorkflowUtils.ts index 6a6ac217..a2d028b2 100644 --- a/src/routes/computePlanDetails/workflow/CPWorkflowUtils.ts +++ b/src/routes/computePlanDetails/workflow/CPWorkflowUtils.ts @@ -10,18 +10,22 @@ export const MIN_ZOOM_LEVEL = 0.05; export const NODE_BORDER_COLOR: Record = { [TaskStatus.failed]: '#F31B61', - [TaskStatus.waiting]: '#ADADAD', + [TaskStatus.waitingBuilderSlot]: '#ADADAD', + [TaskStatus.waitingParentTasks]: '#ADADAD', + [TaskStatus.waitingExecutorSlot]: '#ADADAD', [TaskStatus.done]: '#2F9797', - [TaskStatus.todo]: '#ADADAD', + [TaskStatus.building]: '#0084DC', [TaskStatus.doing]: '#0084DC', [TaskStatus.canceled]: '#545454', }; export const NODE_LABEL_COLOR: Record = { [TaskStatus.failed]: '#CB1C51', - [TaskStatus.waiting]: '#7F7F7F', + [TaskStatus.waitingBuilderSlot]: '#7F7F7F', + [TaskStatus.waitingParentTasks]: '#7F7F7F', + [TaskStatus.waitingExecutorSlot]: '#7F7F7F', [TaskStatus.done]: '#2D7A7A', - [TaskStatus.todo]: '#7F7F7F', + [TaskStatus.building]: '#006EBD', [TaskStatus.doing]: '#006EBD', [TaskStatus.canceled]: '#373737', }; diff --git a/src/routes/computePlanDetails/workflow/components/WorkflowTaskNode.tsx b/src/routes/computePlanDetails/workflow/components/WorkflowTaskNode.tsx index 7597878c..9283534c 100644 --- a/src/routes/computePlanDetails/workflow/components/WorkflowTaskNode.tsx +++ b/src/routes/computePlanDetails/workflow/components/WorkflowTaskNode.tsx @@ -4,6 +4,7 @@ import { Handle, Position } from 'react-flow-renderer'; import { Box, Text, Flex } from '@chakra-ui/react'; +import { getStatusLabel } from '@/libs/status'; import { NODE_BORDER_COLOR, NODE_LABEL_COLOR, @@ -80,7 +81,7 @@ const TaskNode = ({ data }: TaskNodeProps) => { fontWeight="medium" textTransform="capitalize" > - {data.status.replace('STATUS_', '').toLowerCase()} + {getStatusLabel(data.status)} diff --git a/src/routes/tasks/components/DrawerSectionOutModelEntryContent.tsx b/src/routes/tasks/components/DrawerSectionOutModelEntryContent.tsx index af6be8d7..725b6064 100644 --- a/src/routes/tasks/components/DrawerSectionOutModelEntryContent.tsx +++ b/src/routes/tasks/components/DrawerSectionOutModelEntryContent.tsx @@ -18,14 +18,18 @@ const DrawerSectionOutModelEntryContent = ({ let content = null; - if (taskStatus === TaskStatus.waiting) { + if (taskStatus === TaskStatus.waitingBuilderSlot) { content = ( Model training hasn't started yet ); - } else if (taskStatus === TaskStatus.todo) { + } else if (taskStatus === TaskStatus.building) { content = ( Model training hasn't started yet ); + } else if (taskStatus === TaskStatus.waitingParentTasks) { + content = Model waiting; + } else if (taskStatus === TaskStatus.waitingExecutorSlot) { + content = Model still training; } else if (taskStatus === TaskStatus.doing) { content = Model still training; } else if (taskStatus === TaskStatus.failed) { diff --git a/src/routes/tasks/components/TaskOutputsDrawerSection.tsx b/src/routes/tasks/components/TaskOutputsDrawerSection.tsx index edd374d4..e66a6133 100644 --- a/src/routes/tasks/components/TaskOutputsDrawerSection.tsx +++ b/src/routes/tasks/components/TaskOutputsDrawerSection.tsx @@ -30,12 +30,14 @@ const isMultipleOutput = (task: TaskT, output_id: string) => { const displayPerformance = (value: number, taskStatus: TaskStatus) => { if (value === null) { let msg: string; - if ( - taskStatus === TaskStatus.waiting || - taskStatus === TaskStatus.todo - ) { + if (taskStatus === TaskStatus.waitingBuilderSlot) { msg = "computation hasn't started yet"; - } else if (taskStatus === TaskStatus.doing) { + } else if ( + taskStatus === TaskStatus.building || + taskStatus === TaskStatus.waitingParentTasks || + taskStatus === TaskStatus.waitingExecutorSlot || + taskStatus === TaskStatus.doing + ) { msg = 'computation is ongoing'; } else if (taskStatus === TaskStatus.failed) { msg = 'computation failed'; diff --git a/src/types/ComputePlansTypes.ts b/src/types/ComputePlansTypes.ts index 26183af0..9d69f5a7 100644 --- a/src/types/ComputePlansTypes.ts +++ b/src/types/ComputePlansTypes.ts @@ -37,8 +37,10 @@ export type ComputePlanStubT = { task_count: number; status: ComputePlanStatus; done_count: number; - waiting_count: number; - todo_count: number; + waiting_parent_tasks_count: number; + waiting_executor_slot_count: number; + waiting_builder_slot_count: number; + building_count: number; doing_count: number; canceled_count: number; failed_count: number; diff --git a/src/types/TasksTypes.ts b/src/types/TasksTypes.ts index 98fe19a4..afd36562 100644 --- a/src/types/TasksTypes.ts +++ b/src/types/TasksTypes.ts @@ -6,8 +6,10 @@ import { ModelT } from './ModelsTypes'; import { PerformanceAssetT } from './PerformancesTypes'; export enum TaskStatus { - waiting = 'STATUS_WAITING', - todo = 'STATUS_TODO', + waitingExecutorSlot = 'STATUS_WAITING_FOR_EXECUTOR_SLOT', + waitingParentTasks = 'STATUS_WAITING_FOR_PARENT_TASKS', + waitingBuilderSlot = 'STATUS_WAITING_FOR_BUILDER_SLOT', + building = 'STATUS_BUILDING', doing = 'STATUS_DOING', done = 'STATUS_DONE', canceled = 'STATUS_CANCELED', @@ -17,16 +19,20 @@ export enum TaskStatus { export const taskStatusOrder: TaskStatus[] = [ TaskStatus.done, TaskStatus.doing, + TaskStatus.building, TaskStatus.canceled, TaskStatus.failed, - TaskStatus.todo, - TaskStatus.waiting, + TaskStatus.waitingExecutorSlot, + TaskStatus.waitingBuilderSlot, + TaskStatus.waitingParentTasks, ]; export enum TaskStatusDescription { - waiting = 'Task is waiting for parent tasks to end', - todo = 'Task is ready and waiting for available space to run', - doing = 'Task is processing', + waitingParentTasks = 'Task is waiting for parent tasks to end', + waitingExecutorSlot = 'Task is waiting for an available executor to run', + waitingBuilderSlot = 'Task function is waiting for an available builder to build', + doing = 'Task is executing', + building = 'Task function is being built', done = 'Task finished without error', canceled = 'Task was prematurely ended', failed = 'Task has error', @@ -42,8 +48,10 @@ export const statusDescriptionByTaskStatus: Record< TaskStatus, TaskStatusDescription > = { - [TaskStatus.waiting]: TaskStatusDescription.waiting, - [TaskStatus.todo]: TaskStatusDescription.todo, + [TaskStatus.waitingBuilderSlot]: TaskStatusDescription.waitingBuilderSlot, + [TaskStatus.building]: TaskStatusDescription.building, + [TaskStatus.waitingParentTasks]: TaskStatusDescription.waitingParentTasks, + [TaskStatus.waitingExecutorSlot]: TaskStatusDescription.waitingExecutorSlot, [TaskStatus.doing]: TaskStatusDescription.doing, [TaskStatus.done]: TaskStatusDescription.done, [TaskStatus.canceled]: TaskStatusDescription.canceled,