From 4ce5db8508377bd5d4825cc263957bcab1cd2ee1 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Mon, 19 Aug 2024 11:57:23 -0400 Subject: [PATCH] 21413: Add "Resubmitted" process state Process details now directs users to the resubmitted process. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- .../workbench2/src/store/processes/process.ts | 33 +++++++++---- .../process-details-attributes.tsx | 49 +++++++++++-------- 2 files changed, 52 insertions(+), 30 deletions(-) diff --git a/services/workbench2/src/store/processes/process.ts b/services/workbench2/src/store/processes/process.ts index 481fcb863c..3ee8731dfb 100644 --- a/services/workbench2/src/store/processes/process.ts +++ b/services/workbench2/src/store/processes/process.ts @@ -28,6 +28,11 @@ export enum ProcessStatus { UNKNOWN = 'Unknown', REUSED = 'Reused', CANCELLING = 'Cancelling', + RESUBMITTED = 'Resubmitted', +} + +export enum ProcessProperties { + FAILED_CONTAINER_RESUBMITTED = "arv:failed_container_resubmitted", } /** @@ -36,7 +41,7 @@ export enum ProcessStatus { * @returns a Process object with containerRequest and optional container or undefined */ export const getProcess = (uuid: string) => (resources: ResourcesState): Process | undefined => { - if (extractUuidKind(uuid) === ResourceKind.CONTAINER_REQUEST) { + if (extractUuidKind(uuid) === ResourceKind.CONTAINER_REQUEST) { const containerRequest = getResource(uuid)(resources); if (containerRequest) { if (containerRequest.containerUuid) { @@ -97,6 +102,9 @@ export const getProcessStatusStyles = (status: string, theme: ArvadosTheme): Rea color = theme.customs.colors.green800; running = true; break; + case ProcessStatus.RESUBMITTED: + color = theme.customs.colors.orange; + break; case ProcessStatus.FAILING: color = theme.customs.colors.red900; running = true; @@ -138,17 +146,22 @@ export const getProcessStatus = ({ containerRequest, container }: Process): Proc return ProcessStatus.DRAFT; case containerRequest.state === ContainerRequestState.FINAL && - container?.state === ContainerState.RUNNING: - // It is about to be completed but we haven't - // gotten the updated container record yet, - // if we don't catch this and show it as "Running" - // it will flicker "Cancelled" briefly - return ProcessStatus.RUNNING; + Boolean(containerRequest.properties[ProcessProperties.FAILED_CONTAINER_RESUBMITTED]): + // Failed but a new container request for the same work was resubmitted. + return ProcessStatus.RESUBMITTED; + + case containerRequest.state === ContainerRequestState.FINAL && + container?.state === ContainerState.RUNNING: + // It is about to be completed but we haven't + // gotten the updated container record yet, + // if we don't catch this and show it as "Running" + // it will flicker "Cancelled" briefly + return ProcessStatus.RUNNING; case containerRequest.state === ContainerRequestState.FINAL && - container?.state !== ContainerState.COMPLETE: - // Request was finalized before its container started (or the - // container was cancelled) + container?.state !== ContainerState.COMPLETE: + // Request was finalized before its container started (or the + // container was cancelled) return ProcessStatus.CANCELLED; case container && container.state === ContainerState.COMPLETE: diff --git a/services/workbench2/src/views/process-panel/process-details-attributes.tsx b/services/workbench2/src/views/process-panel/process-details-attributes.tsx index 5c666acd1b..d48e7e8ca1 100644 --- a/services/workbench2/src/views/process-panel/process-details-attributes.tsx +++ b/services/workbench2/src/views/process-panel/process-details-attributes.tsx @@ -3,14 +3,14 @@ // SPDX-License-Identifier: AGPL-3.0 import React from "react"; -import { Grid, StyleRulesCallback, withStyles } from "@material-ui/core"; +import { Grid, StyleRulesCallback, withStyles, Typography, } from "@material-ui/core"; import { Dispatch } from 'redux'; import { formatCost, formatDate } from "common/formatters"; import { resourceLabel } from "common/labels"; import { DetailsAttribute } from "components/details-attribute/details-attribute"; import { ResourceKind } from "models/resource"; import { CollectionName, ContainerRunTime, ResourceWithName } from "views-components/data-explorer/renderers"; -import { getProcess, getProcessStatus } from "store/processes/process"; +import { getProcess, getProcessStatus, ProcessProperties } from "store/processes/process"; import { RootState } from "store/store"; import { connect } from "react-redux"; import { ProcessResource, MOUNT_PATH_CWL_WORKFLOW } from "models/process"; @@ -23,6 +23,9 @@ import { ContainerRequestResource } from "models/container-request"; import { filterResources } from "store/resources/resources"; import { JSONMount } from 'models/mount-types'; import { getCollectionUrl } from 'models/collection'; +import { Link } from "react-router-dom"; +import { getResourceUrl } from "routes/routes"; +import WarningIcon from '@material-ui/icons/Warning'; type CssRules = 'link' | 'propertyTag'; @@ -109,24 +112,30 @@ export const ProcessDetailsAttributes = withStyles(styles, { withTheme: true })( {!props.hideProcessPanelRedundantFields && } - - - - - - - - } /> - - - - - {!props.hideProcessPanelRedundantFields && - - } + {containerRequest.properties["arv:failed_container_resubmitted"] && + + + This process failed but was automatically resubmitted. Click here to go to the resubmitted process. + + } + + + + + + + + } /> + + + + + {!props.hideProcessPanelRedundantFields && + + } -- 2.30.2