Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add new compute tasks status linked to function status #297

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion src/components/ComputePlanProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ const ComputePlanProgressBar = ({
alignItems="stretch"
>
{!computePlan.task_count && (
<Item status={TaskStatus.waiting} count={1} total={1} />
<Item
status={TaskStatus.waitingBuilderSlot}
count={1}
total={1}
/>
)}
{taskStatusOrder.map((status) => (
<Item
Expand Down
3 changes: 1 addition & 2 deletions src/components/Timing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ const Timing = ({ asset }: TimingProps): JSX.Element => {
{[
ComputePlanStatus.todo,
ComputePlanStatus.waiting,
TaskStatus.todo,
TaskStatus.waiting,
TaskStatus.waitingBuilderSlot,
].includes(asset.status)
? 'Not started yet'
: 'Information not available'}
Expand Down
18 changes: 12 additions & 6 deletions src/libs/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,21 @@ 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<TaskStatus, TaskStatusLabel> = {
[TaskStatus.canceled]: TaskStatusLabel.canceled,
[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<
Expand Down Expand Up @@ -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,
Expand All @@ -130,6 +135,7 @@ export const getStatusStyle = (
progressColor: 'gray.300',
};
case TaskStatus.doing:
case TaskStatus.building:
case ComputePlanStatus.doing:
return {
icon: RiPlayMiniLine,
Expand Down
12 changes: 8 additions & 4 deletions src/routes/computePlanDetails/ComputePlanUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down
12 changes: 8 additions & 4 deletions src/routes/computePlanDetails/workflow/CPWorkflowUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ export const MIN_ZOOM_LEVEL = 0.05;

export const NODE_BORDER_COLOR: Record<TaskStatus, string> = {
[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, string> = {
[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',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -80,7 +81,7 @@ const TaskNode = ({ data }: TaskNodeProps) => {
fontWeight="medium"
textTransform="capitalize"
>
{data.status.replace('STATUS_', '').toLowerCase()}
{getStatusLabel(data.status)}
</Text>
</Box>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ const DrawerSectionOutModelEntryContent = ({

let content = null;

if (taskStatus === TaskStatus.waiting) {
if (taskStatus === TaskStatus.waitingBuilderSlot) {
content = (
<Text color="gray.500">Model training hasn't started yet</Text>
);
} else if (taskStatus === TaskStatus.todo) {
} else if (taskStatus === TaskStatus.building) {
content = (
<Text color="gray.500">Model training hasn't started yet</Text>
);
} else if (taskStatus === TaskStatus.waitingParentTasks) {
content = <Text color="gray.500">Model waiting</Text>;
} else if (taskStatus === TaskStatus.waitingExecutorSlot) {
content = <Text color="gray.500">Model still training</Text>;
} else if (taskStatus === TaskStatus.doing) {
content = <Text color="gray.500">Model still training</Text>;
} else if (taskStatus === TaskStatus.failed) {
Expand Down
12 changes: 7 additions & 5 deletions src/routes/tasks/components/TaskOutputsDrawerSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 4 additions & 2 deletions src/types/ComputePlansTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 17 additions & 9 deletions src/types/TasksTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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,
Expand Down
Loading