Merge branch '19836-upload-binary-mode' into main
[arvados-workbench2.git] / src / models / process.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ContainerRequestResource } from "./container-request";
6 import { MountType, MountKind } from 'models/mount-types';
7 import { WorkflowResource, parseWorkflowDefinition } from 'models/workflow';
8 import { WorkflowInputsData } from './workflow';
9
10 export type ProcessResource = ContainerRequestResource;
11
12 export const MOUNT_PATH_CWL_WORKFLOW = '/var/lib/cwl/workflow.json';
13 export const MOUNT_PATH_CWL_INPUT = '/var/lib/cwl/cwl.input.json';
14
15 export const createWorkflowMounts = (workflow: WorkflowResource, inputs: WorkflowInputsData): { [path: string]: MountType } => {
16     return {
17         '/var/spool/cwl': {
18             kind: MountKind.COLLECTION,
19             writable: true,
20         },
21         'stdout': {
22             kind: MountKind.MOUNTED_FILE,
23             path: '/var/spool/cwl/cwl.output.json',
24         },
25         '/var/lib/cwl/workflow.json': {
26             kind: MountKind.JSON,
27             content: parseWorkflowDefinition(workflow)
28         },
29         '/var/lib/cwl/cwl.input.json': {
30             kind: MountKind.JSON,
31             content: inputs,
32         }
33     };
34 };