[ARVADOS-WORKBENCH2] updated: 1.2.0-513-gd53f2e8

Git user git at public.curoverse.com
Tue Oct 2 06:32:22 EDT 2018


Summary of changes:
 .../run-process-panel/run-process-panel-actions.ts | 55 ++++++++++++++++++++--
 .../run-process-panel/run-process-panel-reducer.ts |  3 ++
 .../side-panel-button/side-panel-button.tsx        |  8 ++--
 src/views/run-process-panel/run-process-panel.tsx  |  4 +-
 4 files changed, 62 insertions(+), 8 deletions(-)

       via  d53f2e8a10937bff1bb16a4e37e060daddbf3fa5 (commit)
      from  424f5418a6fd9f49baa1cc79bf0b51f9ab65ac58 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit d53f2e8a10937bff1bb16a4e37e060daddbf3fa5
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Oct 2 12:32:05 2018 +0200

    Connect running a process
    
    Feature #13863
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

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 de18e70..07b0b17 100644
--- a/src/store/run-process-panel/run-process-panel-actions.ts
+++ b/src/store/run-process-panel/run-process-panel-actions.ts
@@ -6,9 +6,17 @@ import { Dispatch } from 'redux';
 import { unionize, ofType, UnionOf } from "~/common/unionize";
 import { ServiceRepository } from "~/services/services";
 import { RootState } from '~/store/store';
-import { WorkflowResource } from '~/models/workflow';
+import { WorkflowResource, CommandInputParameter } from '~/models/workflow';
+import { getFormValues } 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';
+import { WorkflowInputsData } from '~/models/workflow';
+import { createWorkflowMounts } from '~/models/process';
+import { ContainerRequestState } from '~/models/container-request';
+import { navigateToProcess } from '../navigation/navigation-action';
 
 export const runProcessPanelActions = unionize({
+    SET_PROCESS_OWNER_UUID: ofType<string>(),
     SET_CURRENT_STEP: ofType<number>(),
     SET_WORKFLOWS: ofType<WorkflowResource[]>(),
     SET_SELECTED_WORKFLOW: ofType<WorkflowResource>(),
@@ -33,9 +41,50 @@ export const loadRunProcessPanel = () =>
         }
     };
 
-export const setWorkflow = (workflow: WorkflowResource) => 
+export const setWorkflow = (workflow: WorkflowResource) =>
     async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
         dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
     };
 
-export const goToStep = (step: number) => runProcessPanelActions.SET_CURRENT_STEP(step);
\ No newline at end of file
+export const goToStep = (step: number) => runProcessPanelActions.SET_CURRENT_STEP(step);
+
+export const runProcess = async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+    const state = getState();
+    const basicForm = getFormValues(RUN_PROCESS_BASIC_FORM)(state) as RunProcessBasicFormData;
+    const inputsForm = getFormValues(RUN_PROCESS_INPUTS_FORM)(state) as WorkflowInputsData;
+    const { processOwnerUuid, selectedWorkflow } = state.runProcessPanel;
+    if (selectedWorkflow) {
+        const newProcessData = {
+            ownerUuid: processOwnerUuid,
+            name: basicForm.name,
+            description: basicForm.description,
+            state: ContainerRequestState.COMMITTED,
+            mounts: createWorkflowMounts(selectedWorkflow, normalizeInputKeys(inputsForm)),
+            runtimeConstraints: {
+                API: true,
+                vcpus: 1,
+                ram: 1073741824,
+            },
+            containerImage: 'arvados/jobs:1.1.4.20180618144723',
+            cwd: '/var/spool/cwl',
+            command: [
+                'arvados-cwl-runner',
+                '--local',
+                '--api=containers',
+                `--project-uuid=${processOwnerUuid}`,
+                '/var/lib/cwl/workflow.json#main',
+                '/var/lib/cwl/cwl.input.json'
+            ],
+            outputPath: '/var/spool/cwl',
+            priority: 1,
+        };
+        const newProcess = await services.containerRequestService.create(newProcessData);
+        dispatch(navigateToProcess(newProcess.uuid));
+    }
+};
+
+const normalizeInputKeys = (inputs: WorkflowInputsData): WorkflowInputsData =>
+    Object.keys(inputs).reduce((normalizedInputs, key) => ({
+        ...normalizedInputs,
+        [key.split('/').slice(1).join('/')]: inputs[key],
+    }), {});
\ No newline at end of file
diff --git a/src/store/run-process-panel/run-process-panel-reducer.ts b/src/store/run-process-panel/run-process-panel-reducer.ts
index f91039b..2470de1 100644
--- a/src/store/run-process-panel/run-process-panel-reducer.ts
+++ b/src/store/run-process-panel/run-process-panel-reducer.ts
@@ -6,6 +6,7 @@ import { RunProcessPanelAction, runProcessPanelActions } from '~/store/run-proce
 import { WorkflowResource, CommandInputParameter, getWorkflowInputs, parseWorkflowDefinition } from '~/models/workflow';
 
 interface RunProcessPanel {
+    processOwnerUuid: string;
     currentStep: number;
     workflows: WorkflowResource[];
     selectedWorkflow: WorkflowResource | undefined;
@@ -13,6 +14,7 @@ interface RunProcessPanel {
 }
 
 const initialState: RunProcessPanel = {
+    processOwnerUuid: '',
     currentStep: 0,
     workflows: [],
     selectedWorkflow: undefined,
@@ -21,6 +23,7 @@ const initialState: RunProcessPanel = {
 
 export const runProcessPanelReducer = (state = initialState, action: RunProcessPanelAction): RunProcessPanel =>
     runProcessPanelActions.match(action, {
+        SET_PROCESS_OWNER_UUID: processOwnerUuid => ({ ...state, processOwnerUuid }),
         SET_CURRENT_STEP: currentStep => ({ ...state, currentStep }),
         SET_WORKFLOWS: workflows => ({ ...state, workflows }),
         SET_SELECTED_WORKFLOW: selectedWorkflow => ({
diff --git a/src/views-components/side-panel-button/side-panel-button.tsx b/src/views-components/side-panel-button/side-panel-button.tsx
index 2e8433a..9ba2326 100644
--- a/src/views-components/side-panel-button/side-panel-button.tsx
+++ b/src/views-components/side-panel-button/side-panel-button.tsx
@@ -15,6 +15,7 @@ import { openProjectCreateDialog } from '~/store/projects/project-create-actions
 import { openCollectionCreateDialog } from '~/store/collections/collection-create-actions';
 import { matchProjectRoute } from '~/routes/routes';
 import { navigateToRunProcess } from '~/store/navigation/navigation-action';
+import { runProcessPanelActions } from '~/store/run-process-panel/run-process-panel-actions';
 
 type CssRules = 'button' | 'menuItem' | 'icon';
 
@@ -67,10 +68,10 @@ export const SidePanelButton = withStyles(styles)(
             };
 
             render() {
-                const { classes, buttonVisible  } = this.props;
+                const { classes, buttonVisible } = this.props;
                 const { anchorEl } = this.state;
                 return <Toolbar>
-                    {buttonVisible  && <Grid container>
+                    {buttonVisible && <Grid container>
                         <Grid container item xs alignItems="center" justify="flex-start">
                             <Button variant="contained" color="primary" size="small" className={classes.button}
                                 aria-owns={anchorEl ? 'aside-menu-list' : undefined}
@@ -97,7 +98,7 @@ export const SidePanelButton = withStyles(styles)(
                                 </MenuItem>
                             </Menu>
                         </Grid>
-                    </Grid> }
+                    </Grid>}
                 </Toolbar>;
             }
 
@@ -106,6 +107,7 @@ export const SidePanelButton = withStyles(styles)(
             }
 
             handleRunProcessClick = () => {
+                this.props.dispatch(runProcessPanelActions.SET_PROCESS_OWNER_UUID(this.props.currentItemId));
                 this.props.dispatch<any>(navigateToRunProcess);
             }
 
diff --git a/src/views/run-process-panel/run-process-panel.tsx b/src/views/run-process-panel/run-process-panel.tsx
index dd7b085..68917c2 100644
--- a/src/views/run-process-panel/run-process-panel.tsx
+++ b/src/views/run-process-panel/run-process-panel.tsx
@@ -6,7 +6,7 @@ import { Dispatch } from 'redux';
 import { connect } from 'react-redux';
 import { RootState } from '~/store/store';
 import { RunProcessPanelRootDataProps, RunProcessPanelRootActionProps, RunProcessPanelRoot } from '~/views/run-process-panel/run-process-panel-root';
-import { goToStep, setWorkflow } from '~/store/run-process-panel/run-process-panel-actions';
+import { goToStep, setWorkflow, runProcess } from '~/store/run-process-panel/run-process-panel-actions';
 import { WorkflowResource } from '~/models/workflow';
 
 const mapStateToProps = ({ runProcessPanel }: RootState): RunProcessPanelRootDataProps => {
@@ -25,7 +25,7 @@ const mapDispatchToProps = (dispatch: Dispatch): RunProcessPanelRootActionProps
         dispatch<any>(setWorkflow(workflow));
     },
     runProcess: () => {
-        console.log('run process!');
+        dispatch<any>(runProcess);
     }
 });
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list