Merge branch '16159-logout-request-with-token'
[arvados-workbench2.git] / src / store / run-process-panel / run-process-panel-actions.ts
index 3cc6e7131939b884d925153b456eb39ce2a06284..d9686feb4b2b7dcbe28681a6977b75cb7fd59518 100644 (file)
@@ -21,7 +21,6 @@ import {
 } 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';
 
 export const runProcessPanelActions = unionize({
     SET_PROCESS_PATHNAME: ofType<string>(),
@@ -85,9 +84,9 @@ export const getWorkflowRunnerSettings = (workflow: WorkflowResource) => {
     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.ramMin) { advancedFormValues[RAM_FIELD] = resc.ramMin * (1024 * 1024); }
             if (resc.coresMin) { advancedFormValues[VCPUS_FIELD] = resc.coresMin; }
-            if (resc.keep_cache) { advancedFormValues[KEEP_CACHE_RAM_FIELD] = resc.keep_cache; }
+            if (resc.keep_cache) { advancedFormValues[KEEP_CACHE_RAM_FIELD] = resc.keep_cache * (1024 * 1024); }
             if (resc.acrContainerImage) { advancedFormValues[RUNNER_IMAGE_FIELD] = resc.acrContainerImage; }
         }
     }
@@ -144,9 +143,8 @@ export const runProcess = async (dispatch: Dispatch<any>, getState: () => RootSt
     const inputsForm = getFormValues(RUN_PROCESS_INPUTS_FORM)(state) as WorkflowInputsData;
     const userUuid = getUserUuid(getState());
     if (!userUuid) { return; }
-    const pathname = getState().runProcessPanel.processPathname;
     const { processOwnerUuid, selectedWorkflow } = state.runProcessPanel;
-    const ownerUUid = !matchProjectRoute(pathname) ? userUuid : processOwnerUuid;
+    const ownerUUid = processOwnerUuid ? processOwnerUuid : userUuid;
     if (selectedWorkflow) {
         const advancedForm = getFormValues(RUN_PROCESS_ADVANCED_FORM)(state) as RunProcessAdvancedFormData || getWorkflowRunnerSettings(selectedWorkflow);
         const newProcessData = {
@@ -158,7 +156,7 @@ export const runProcess = async (dispatch: Dispatch<any>, getState: () => RootSt
             runtimeConstraints: {
                 API: true,
                 vcpus: advancedForm[VCPUS_FIELD],
-                ram: advancedForm[RAM_FIELD],
+                ram: (advancedForm[KEEP_CACHE_RAM_FIELD] + advancedForm[RAM_FIELD]),
             },
             schedulingParameters: {
                 max_run_time: advancedForm[RUNTIME_FIELD]
@@ -186,9 +184,10 @@ export const runProcess = async (dispatch: Dispatch<any>, getState: () => RootSt
     }
 };
 
-export const DEFAULT_ADVANCED_FORM_VALUES: Partial<RunProcessAdvancedFormData> = {
+const DEFAULT_ADVANCED_FORM_VALUES: Partial<RunProcessAdvancedFormData> = {
     [VCPUS_FIELD]: 1,
     [RAM_FIELD]: 1073741824,
+    [KEEP_CACHE_RAM_FIELD]: 268435456,
     [RUNNER_IMAGE_FIELD]: "arvados/jobs"
 };