} 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>(),
}
};
+export const getWorkflowRunnerSettings = (workflow: WorkflowResource) => {
+ 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 * (1024 * 1024); }
+ if (resc.coresMin) { advancedFormValues[VCPUS_FIELD] = resc.coresMin; }
+ if (resc.keep_cache) { advancedFormValues[KEEP_CACHE_RAM_FIELD] = resc.keep_cache * (1024 * 1024); }
+ if (resc.acrContainerImage) { advancedFormValues[RUNNER_IMAGE_FIELD] = resc.acrContainerImage; }
+ }
+ }
+ return advancedFormValues;
+};
+
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; }
- }
- }
+ const advancedFormValues = getWorkflowRunnerSettings(workflow);
if (isStepChanged && isWorkflowChanged) {
dispatch(runProcessPanelActions.SET_STEP_CHANGED(false));
const state = getState();
const basicForm = getFormValues(RUN_PROCESS_BASIC_FORM)(state) as RunProcessBasicFormData;
const inputsForm = getFormValues(RUN_PROCESS_INPUTS_FORM)(state) as WorkflowInputsData;
- const advancedForm = getFormValues(RUN_PROCESS_ADVANCED_FORM)(state) as RunProcessAdvancedFormData || DEFAULT_ADVANCED_FORM_VALUES;
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 = {
ownerUuid: ownerUUid,
name: basicForm.name,
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]
}
};
-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"
};