Merge branch '19093-process-failed-warning' into main. Closes #19093
authorStephen Smith <stephen@curii.com>
Fri, 24 Jun 2022 12:54:11 +0000 (08:54 -0400)
committerStephen Smith <stephen@curii.com>
Fri, 24 Jun 2022 12:54:11 +0000 (08:54 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

cypress/integration/collection.spec.js
cypress/integration/process.spec.js
src/views-components/process-runtime-status/process-runtime-status.tsx
src/views/process-panel/process-details-attributes.tsx

index fd8e65b26f5f9c60cf54edc2b06ba5553f39731f..28454a9093b3e87499b8daf652ecafb01df4fdaa 100644 (file)
@@ -374,7 +374,7 @@ describe('Collection panel tests', function () {
                 cy.goToPath(`/collections/${this.testCollection.uuid}`);
 
                 ['subdir', 'G%C3%BCnter\'s%20file', 'table%&?*2'].forEach((subdir) => {
-                    cy.get('[data-cy=collection-files-panel]')
+                    cy.waitForDom().get('[data-cy=collection-files-panel]')
                         .contains('bar').rightclick();
                     cy.get('[data-cy=context-menu]')
                         .contains('Rename')
@@ -642,7 +642,7 @@ describe('Collection panel tests', function () {
                     .contains(projName).and('contain', testProject.uuid);
                 // Double check that the collection is in the project
                 cy.goToPath(`/projects/${testProject.uuid}`);
-                cy.get('[data-cy=project-panel]').should('contain', collName);
+                cy.waitForDom().get('[data-cy=project-panel]').should('contain', collName);
             });
     });
 
index 48b936cf69c8e50e225b32e8d316826cec67c141..faf70c49ec2fe93ec813b0cf821985e33ec81d9c 100644 (file)
@@ -244,5 +244,27 @@ describe('Process tests', function() {
                 .should('contain', 'Free disk space is low')
                 .and('contain', 'No additional warning details available');
         });
+
+
+        // Force container_count for testing
+        let containerCount = 2;
+        cy.intercept({method: 'GET', url: '**/arvados/v1/container_requests/*'}, (req) => {
+            req.reply((res) => {
+                res.body.container_count = containerCount;
+            });
+        });
+
+        cy.getAll('@containerRequest').then(function([containerRequest]) {
+            cy.goToPath(`/processes/${containerRequest.uuid}`);
+            cy.get('[data-cy=process-runtime-status-retry-warning]')
+                .should('contain', 'Process retried 1 time');
+        });
+
+        cy.getAll('@containerRequest').then(function([containerRequest]) {
+            containerCount = 3;
+            cy.goToPath(`/processes/${containerRequest.uuid}`);
+            cy.get('[data-cy=process-runtime-status-retry-warning]')
+                .should('contain', 'Process retried 2 times');
+        });
     });
 });
index 3858e49e2372be08549f81816327138ffb09c046..3b5fae3639591a224a6860e24ab57921afa3fbf0 100644 (file)
@@ -7,6 +7,7 @@ import {
     ExpansionPanel,
     ExpansionPanelDetails,
     ExpansionPanelSummary,
+    Paper,
     StyleRulesCallback,
     Typography,
     withStyles,
@@ -26,7 +27,8 @@ type CssRules = 'root'
     | 'error'
     | 'errorColor'
     | 'warning'
-    | 'warningColor';
+    | 'warningColor'
+    | 'paperRoot';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
@@ -65,15 +67,21 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     warningColor: {
         color: theme.customs.colors.yellow900,
     },
+    paperRoot: {
+        minHeight: theme.spacing.unit * 6,
+        display: 'flex',
+        alignItems: 'center',
+    },
 });
 export interface ProcessRuntimeStatusDataProps {
     runtimeStatus: RuntimeStatus | undefined;
+    containerCount: number;
 }
 
 type ProcessRuntimeStatusProps = ProcessRuntimeStatusDataProps & WithStyles<CssRules>;
 
 export const ProcessRuntimeStatus = withStyles(styles)(
-    ({ runtimeStatus, classes }: ProcessRuntimeStatusProps) => {
+    ({ runtimeStatus, containerCount, classes }: ProcessRuntimeStatusProps) => {
     return <div className={classes.root}>
         { runtimeStatus?.error &&
         <div data-cy='process-runtime-status-error'><ExpansionPanel className={classes.error} elevation={0}>
@@ -103,5 +111,14 @@ export const ProcessRuntimeStatus = withStyles(styles)(
             </ExpansionPanelDetails>
         </ExpansionPanel></div>
         }
+        { containerCount > 1 &&
+        <div data-cy='process-runtime-status-retry-warning' >
+            <Paper className={classNames(classes.warning, classes.paperRoot)} elevation={0}>
+                <Typography className={classNames(classes.heading, classes.summary, classes.warningColor)}>
+                    {`Warning: Process retried ${containerCount - 1} time${containerCount > 2 ? 's' : ''} due to failure.`}
+                </Typography>
+            </Paper>
+        </div>
+        }
     </div>
-});
\ No newline at end of file
+});
index 1e3e5591e78341a4253ba2eb2442537b9923c70e..4af2c9cda75392cfd45f8707206913a5d56e3d95 100644 (file)
@@ -64,7 +64,7 @@ export const ProcessDetailsAttributes = withStyles(styles, { withTheme: true })(
             const mdSize = props.twoCol ? 6 : 12;
             return <Grid container>
                 <Grid item xs={12}>
-                    <ProcessRuntimeStatus runtimeStatus={container?.runtimeStatus} />
+                    <ProcessRuntimeStatus runtimeStatus={container?.runtimeStatus} containerCount={containerRequest.containerCount} />
                 </Grid>
                 {!props.hideProcessPanelRedundantFields && <Grid item xs={12} md={mdSize}>
                     <DetailsAttribute label='Type' value={resourceLabel(ResourceKind.PROCESS)} />