[arvados-workbench2] created: 2.6.3-51-gdf0c1e74

git repository hosting git at public.arvados.org
Wed Aug 9 20:28:23 UTC 2023


        at  df0c1e74137bfbd9263da9966ab9d171af5aba07 (commit)


commit df0c1e74137bfbd9263da9966ab9d171af5aba07
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Wed Aug 9 16:27:51 2023 -0400

    20454: Consolidate cost display to a single 'Cost' field
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/models/container-request.ts b/src/models/container-request.ts
index 02a8ea70..d3adb03a 100644
--- a/src/models/container-request.ts
+++ b/src/models/container-request.ts
@@ -53,6 +53,7 @@ export const containerRequestFieldsNoMounts = [
     "container_image",
     "container_uuid",
     "created_at",
+    "cumulative_cost",
     "cwd",
     "description",
     "environment",
diff --git a/src/store/processes/processes-actions.ts b/src/store/processes/processes-actions.ts
index 4a27cba6..b6ff4b71 100644
--- a/src/store/processes/processes-actions.ts
+++ b/src/store/processes/processes-actions.ts
@@ -40,7 +40,7 @@ export const loadProcess = (containerRequestUuid: string) =>
             try {
                 const collection = await services.collectionService.get(containerRequest.outputUuid, false);
                 dispatch<any>(updateResources([collection]));
-            } catch {}
+            } catch { }
         }
 
         if (containerRequest.containerUuid) {
@@ -48,14 +48,14 @@ export const loadProcess = (containerRequestUuid: string) =>
             try {
                 container = await services.containerService.get(containerRequest.containerUuid, false);
                 dispatch<any>(updateResources([container]));
-            } catch {}
+            } catch { }
 
-            try{
+            try {
                 if (container && container.runtimeUserUuid) {
                     const runtimeUser = await services.userService.get(container.runtimeUserUuid, false);
                     dispatch<any>(updateResources([runtimeUser]));
                 }
-            } catch {}
+            } catch { }
 
             return { containerRequest, container };
         }
@@ -67,7 +67,7 @@ export const loadContainers = (containerUuids: string[], loadMounts: boolean = t
         let args: any = {
             filters: new FilterBuilder().addIn('uuid', containerUuids).getFilters(),
             limit: containerUuids.length,
-         };
+        };
         if (!loadMounts) {
             args.select = containerFieldsNoMounts;
         }
@@ -112,6 +112,7 @@ const containerFieldsNoMounts = [
     "scheduling_parameters",
     "started_at",
     "state",
+    "subrequests_cost",
     "uuid",
 ]
 
@@ -210,7 +211,7 @@ export const getRawInputs = (data: any): WorkflowInputsData | undefined => {
 export const getInputs = (data: any): CommandInputParameter[] => {
     // Definitions from mounts are needed so we return early if missing
     if (!data || !data.mounts || !data.mounts[MOUNT_PATH_CWL_WORKFLOW]) { return []; }
-    const content  = getRawInputs(data) as any;
+    const content = getRawInputs(data) as any;
     // Only escape if content is falsy to allow displaying definitions if no inputs are present
     // (Don't check raw content length)
     if (!content) { return []; }
@@ -252,8 +253,8 @@ export const getInputCollectionMounts = (data: any): InputCollectionMount[] => {
             path: key,
         }))
         .filter(mount => mount.kind === 'collection' &&
-                mount.portable_data_hash &&
-                mount.path)
+            mount.portable_data_hash &&
+            mount.path)
         .map(mount => ({
             path: mount.path,
             pdh: mount.portable_data_hash,
@@ -297,7 +298,7 @@ export const removeProcessPermanently = (uuid: string) =>
             await services.containerRequestService.delete(uuid, false);
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
-        } catch(e) {
+        } catch (e) {
             const error = getCommonResourceServiceError(e);
             if (error === CommonResourceServiceError.PERMISSION_ERROR_FORBIDDEN) {
                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: `Access denied`, hideDuration: 2000, kind: SnackbarKind.ERROR }));
diff --git a/src/views/process-panel/process-details-attributes.tsx b/src/views/process-panel/process-details-attributes.tsx
index 7bdf8897..b0d8039f 100644
--- a/src/views/process-panel/process-details-attributes.tsx
+++ b/src/views/process-panel/process-details-attributes.tsx
@@ -68,7 +68,9 @@ export const ProcessDetailsAttributes = withStyles(styles, { withTheme: true })(
             const classes = props.classes;
             const mdSize = props.twoCol ? 6 : 12;
             const filteredPropertyKeys = Object.keys(containerRequest.properties)
-                                            .filter(k => (typeof containerRequest.properties[k] !== 'object'));
+                .filter(k => (typeof containerRequest.properties[k] !== 'object'));
+            const hasTotalCost = containerRequest && containerRequest.cumulativeCost > 0;
+            const totalCostNotReady = container && container.cost > 0 && container.state === "Running" && containerRequest && containerRequest.cumulativeCost === 0 && subprocesses.length > 0;
             return <Grid container>
                 <Grid item xs={12}>
                     <ProcessRuntimeStatus runtimeStatus={container?.runtimeStatus} containerCount={containerRequest.containerCount} />
@@ -127,11 +129,10 @@ export const ProcessDetailsAttributes = withStyles(styles, { withTheme: true })(
                         <CollectionName className={classes.link} uuid={containerRequest.outputUuid} />
                     </span>}
                 </Grid>
-                {container && container.cost > 0 && <Grid item xs={12} md={mdSize}>
-                        <DetailsAttribute label='Cost ' value={formatContainerCost(container.cost)} />
-                </Grid>}
-                {containerRequest && containerRequest.cumulativeCost > 0 && subprocesses.length > 0 && <Grid item xs={12} md={mdSize}>
-                    <DetailsAttribute label='Container & subprocess cost' value={formatContainerCost(containerRequest.cumulativeCost)} />
+                {container && <Grid item xs={12} md={mdSize}>
+                    <DetailsAttribute label='Cost' value={
+                        `${hasTotalCost ? formatContainerCost(containerRequest.cumulativeCost) + ' total, ' : (totalCostNotReady ? 'total pending completion, ' : '')}${container.cost > 0 ? formatContainerCost(container.cost) : 'not available'} for this container`
+                    } />
                 </Grid>}
                 {containerRequest.properties.template_uuid &&
                     <Grid item xs={12} md={mdSize}>
@@ -144,9 +145,9 @@ export const ProcessDetailsAttributes = withStyles(styles, { withTheme: true })(
                     <DetailsAttribute label='Priority' value={containerRequest.priority} />
                 </Grid>
                 {/*
-                    NOTE: The property list should be kept at the bottom, because it spans
-                    the entire available width, without regards of the twoCol prop.
-                */}
+			NOTE: The property list should be kept at the bottom, because it spans
+			the entire available width, without regards of the twoCol prop.
+			*/}
                 <Grid item xs={12} md={12}>
                     <DetailsAttribute label='Properties' />
                     {filteredPropertyKeys.length > 0

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list