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';
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';
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));
}
};
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',
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 =>
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';
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;
[RAM_FIELD]: number;
[VCPUS_FIELD]: number;
[KEEP_CACHE_RAM_FIELD]?: number;
- [API_FIELD]?: boolean;
+ [RUNNER_IMAGE_FIELD]: string;
}
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>