[ARVADOS-WORKBENCH2] created: 1.4.1-410-g3e14ac85

Git user git at public.arvados.org
Wed Aug 26 21:19:00 UTC 2020


        at  3e14ac8582fb8f73fd1807fa0a3b10c88cc89921 (commit)


commit 3e14ac8582fb8f73fd1807fa0a3b10c88cc89921
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Wed Aug 26 17:18:09 2020 -0400

    16602: Read WorkflowRunnerResources from workflow to get advanced settings
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/models/workflow.ts b/src/models/workflow.ts
index abc92c62..ad84bd9e 100644
--- a/src/models/workflow.ts
+++ b/src/models/workflow.ts
@@ -22,6 +22,7 @@ export interface Workflow {
     inputs: CommandInputParameter[];
     outputs: any[];
     steps: any[];
+    hints?: ProcessRequirement[];
 }
 
 export interface CommandLineTool {
@@ -29,6 +30,21 @@ export interface CommandLineTool {
     id: string;
     inputs: CommandInputParameter[];
     outputs: any[];
+    hints?: ProcessRequirement[];
+}
+
+export type ProcessRequirement = GenericProcessRequirement | WorkflowRunnerResources;
+
+export interface GenericProcessRequirement {
+    class: string;
+}
+
+export interface WorkflowRunnerResources {
+    class: 'http://arvados.org/cwl#WorkflowRunnerResources';
+    ramMin?: number;
+    coresMin?: number;
+    keep_cache?: number;
+    acrContainerImage?: string;
 }
 
 export type CommandInputParameter =
diff --git a/src/store/processes/processes-actions.ts b/src/store/processes/processes-actions.ts
index ab51f9ca..ba70f914 100644
--- a/src/store/processes/processes-actions.ts
+++ b/src/store/processes/processes-actions.ts
@@ -69,7 +69,7 @@ export const reRunProcess = (processUuid: string, workflowUuid: string) =>
                 ram: process.runtimeConstraints.ram,
                 vcpus: process.runtimeConstraints.vcpus,
                 keep_cache_ram: process.runtimeConstraints.keep_cache_ram,
-                api: process.runtimeConstraints.API
+                acr_container_image: process.containerImage
             };
             dispatch<any>(initialize(RUN_PROCESS_ADVANCED_FORM, advancedInitialData));
 
diff --git a/src/store/run-process-panel/run-process-panel-actions.ts b/src/store/run-process-panel/run-process-panel-actions.ts
index 2397601d..f925c5c4 100644
--- a/src/store/run-process-panel/run-process-panel-actions.ts
+++ b/src/store/run-process-panel/run-process-panel-actions.ts
@@ -7,7 +7,7 @@ import { unionize, ofType, UnionOf } from "~/common/unionize";
 import { ServiceRepository } from "~/services/services";
 import { RootState } from '~/store/store';
 import { getUserUuid } from "~/common/getuser";
-import { WorkflowResource, getWorkflowInputs, parseWorkflowDefinition } from '~/models/workflow';
+import { WorkflowResource, WorkflowRunnerResources, getWorkflow, getWorkflowInputs, parseWorkflowDefinition } from '~/models/workflow';
 import { getFormValues, initialize } from 'redux-form';
 import { RUN_PROCESS_BASIC_FORM, RunProcessBasicFormData } from '~/views/run-process-panel/run-process-basic-form';
 import { RUN_PROCESS_INPUTS_FORM } from '~/views/run-process-panel/run-process-inputs-form';
@@ -15,7 +15,10 @@ import { WorkflowInputsData } from '~/models/workflow';
 import { createWorkflowMounts } from '~/models/process';
 import { ContainerRequestState } from '~/models/container-request';
 import { navigateTo } from '../navigation/navigation-action';
-import { RunProcessAdvancedFormData, RUN_PROCESS_ADVANCED_FORM, VCPUS_FIELD, RAM_FIELD, RUNTIME_FIELD, OUTPUT_FIELD, API_FIELD } from '~/views/run-process-panel/run-process-advanced-form';
+import {
+    RunProcessAdvancedFormData, RUN_PROCESS_ADVANCED_FORM, VCPUS_FIELD,
+    KEEP_CACHE_RAM_FIELD, RAM_FIELD, RUNTIME_FIELD, OUTPUT_FIELD, RUNNER_IMAGE_FIELD
+} from '~/views/run-process-panel/run-process-advanced-form';
 import { dialogActions } from '~/store/dialog/dialog-actions';
 import { setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
 import { matchProjectRoute } from '~/routes/routes';
@@ -76,16 +79,32 @@ export const openSetWorkflowDialog = (workflow: WorkflowResource) =>
 export const setWorkflow = (workflow: WorkflowResource, isWorkflowChanged = true) =>
     (dispatch: Dispatch<any>, getState: () => RootState) => {
         const isStepChanged = getState().runProcessPanel.isStepChanged;
+
+        const advancedFormValues = {};
+        Object.assign(advancedFormValues, DEFAULT_ADVANCED_FORM_VALUES);
+
+        const wf = getWorkflow(parseWorkflowDefinition(workflow));
+        const hints = wf ? wf.hints : undefined;
+        if (hints) {
+            const resc = hints.find(item => item.class === 'http://arvados.org/cwl#WorkflowRunnerResources') as WorkflowRunnerResources | undefined;
+            if (resc) {
+                if (resc.ramMin) { advancedFormValues[RAM_FIELD] = resc.ramMin; }
+                if (resc.coresMin) { advancedFormValues[VCPUS_FIELD] = resc.coresMin; }
+                if (resc.keep_cache) { advancedFormValues[KEEP_CACHE_RAM_FIELD] = resc.keep_cache; }
+                if (resc.acrContainerImage) { advancedFormValues[RUNNER_IMAGE_FIELD] = resc.acrContainerImage; }
+            }
+        }
+
         if (isStepChanged && isWorkflowChanged) {
             dispatch(runProcessPanelActions.SET_STEP_CHANGED(false));
             dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
             dispatch<any>(loadPresets(workflow.uuid));
-            dispatch(initialize(RUN_PROCESS_ADVANCED_FORM, DEFAULT_ADVANCED_FORM_VALUES));
+            dispatch(initialize(RUN_PROCESS_ADVANCED_FORM, advancedFormValues));
         }
         if (!isWorkflowChanged) {
             dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
             dispatch<any>(loadPresets(workflow.uuid));
-            dispatch(initialize(RUN_PROCESS_ADVANCED_FORM, DEFAULT_ADVANCED_FORM_VALUES));
+            dispatch(initialize(RUN_PROCESS_ADVANCED_FORM, advancedFormValues));
         }
     };
 
@@ -135,12 +154,11 @@ export const runProcess = async (dispatch: Dispatch<any>, getState: () => RootSt
                 API: true,
                 vcpus: advancedForm[VCPUS_FIELD],
                 ram: advancedForm[RAM_FIELD],
-                api: advancedForm[API_FIELD],
             },
             schedulingParameters: {
                 max_run_time: advancedForm[RUNTIME_FIELD]
             },
-            containerImage: 'arvados/jobs',
+            containerImage: advancedForm[RUNNER_IMAGE_FIELD],
             cwd: '/var/spool/cwl',
             command: [
                 'arvados-cwl-runner',
@@ -166,7 +184,7 @@ export const runProcess = async (dispatch: Dispatch<any>, getState: () => RootSt
 export const DEFAULT_ADVANCED_FORM_VALUES: Partial<RunProcessAdvancedFormData> = {
     [VCPUS_FIELD]: 1,
     [RAM_FIELD]: 1073741824,
-    [API_FIELD]: true,
+    [RUNNER_IMAGE_FIELD]: "arvados/jobs"
 };
 
 const normalizeInputKeys = (inputs: WorkflowInputsData): WorkflowInputsData =>
diff --git a/src/views/run-process-panel/run-process-advanced-form.tsx b/src/views/run-process-panel/run-process-advanced-form.tsx
index 0400b850..d9848291 100644
--- a/src/views/run-process-panel/run-process-advanced-form.tsx
+++ b/src/views/run-process-panel/run-process-advanced-form.tsx
@@ -11,7 +11,6 @@ import { ExpandIcon } from '~/components/icon/icon';
 import * as IntInput from './inputs/int-input';
 import { min } from '~/validators/min';
 import { optional } from '~/validators/optional';
-import { SwitchField } from '~/components/switch-field/switch-field';
 
 export const RUN_PROCESS_ADVANCED_FORM = 'runProcessAdvancedForm';
 
@@ -20,7 +19,7 @@ export const RUNTIME_FIELD = 'runtime';
 export const RAM_FIELD = 'ram';
 export const VCPUS_FIELD = 'vcpus';
 export const KEEP_CACHE_RAM_FIELD = 'keep_cache_ram';
-export const API_FIELD = 'api';
+export const RUNNER_IMAGE_FIELD = 'acr_container_image';
 
 export interface RunProcessAdvancedFormData {
     [OUTPUT_FIELD]?: string;
@@ -28,7 +27,7 @@ export interface RunProcessAdvancedFormData {
     [RAM_FIELD]: number;
     [VCPUS_FIELD]: number;
     [KEEP_CACHE_RAM_FIELD]?: number;
-    [API_FIELD]?: boolean;
+    [RUNNER_IMAGE_FIELD]: string;
 }
 
 export const RunProcessAdvancedForm =
@@ -96,13 +95,11 @@ export const RunProcessAdvancedForm =
                         </Grid>
                         <Grid item xs={12} md={6}>
                             <Field
-                                name={API_FIELD}
-                                component={SwitchField}
-                                switchProps={{
-                                    color: 'primary'
-                                }}
-                                label='API'
-                                helperText='When set, ARVADOS_API_HOST and ARVADOS_API_TOKEN will be set, and process will have networking enabled to access the Arvados API server.' />
+                                name={RUNNER_IMAGE_FIELD}
+                                component={TextField}
+                                label='Runner'
+                                required
+                                helperText='The container image with arvados-cwl-runner that will execute this workflow.' />
                         </Grid>
                     </Grid>
                 </ExpansionPanelDetails>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list