[ARVADOS-WORKBENCH2] created: 1.2.0-462-gb695802

Git user git at public.curoverse.com
Thu Sep 27 09:42:59 EDT 2018


        at  b6958027ba915d64ab7d6e6c2ee4cae765324294 (commit)


commit b6958027ba915d64ab7d6e6c2ee4cae765324294
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Thu Sep 27 15:42:49 2018 +0200

    Update models, create workflow service, create helper process run function
    
    Feature #13863
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/index.tsx b/src/index.tsx
index 5285284..542ce6c 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -39,6 +39,8 @@ import { setCurrentTokenDialogApiHost } from '~/store/current-token-dialog/curre
 import { processResourceActionSet } from '~/views-components/context-menu/action-sets/process-resource-action-set';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
 import { trashedCollectionActionSet } from '~/views-components/context-menu/action-sets/trashed-collection-action-set';
+import { ContainerRequestState } from '~/models/container-request';
+import { MountKind } from './models/mount-types';
 
 const getBuildNumber = () => "BN-" + (process.env.REACT_APP_BUILD_NUMBER || "dev");
 const getGitCommit = () => "GIT-" + (process.env.REACT_APP_GIT_COMMIT || "latest").substr(0, 7);
@@ -109,8 +111,130 @@ const initListener = (history: History, store: RootStore, services: ServiceRepos
             initWebSocket(config, services.authService, store);
             await store.dispatch(loadWorkbench());
             addRouteChangeHandlers(history, store);
+            // createSampleProcess(services);
         }
     };
 };
 
 
+const createSampleProcess = ({ containerRequestService }: ServiceRepository) => {
+    containerRequestService.create({
+        ownerUuid: 'c97qk-j7d0g-s3ngc1z0748hsmf',
+        name: 'Simple process 7',
+        state: ContainerRequestState.COMMITTED,
+        mounts: {
+            '/var/spool/cwl': {
+                kind: MountKind.COLLECTION,
+                writable: true,
+            },
+            'stdout': {
+                kind: MountKind.MOUNTED_FILE,
+                path: '/var/spool/cwl/cwl.output.json'
+            },
+            '/var/lib/cwl/workflow.json': {
+                kind: MountKind.JSON,
+                content: {
+                    "cwlVersion": "v1.0",
+                    "$graph": [
+                        {
+                            "class": "CommandLineTool",
+                            "requirements": [
+                                {
+                                  "listing": [
+                                    {
+                                      "entryname": "input_collector.log",
+                                      "entry": "$(inputs.single_file.basename)\n"
+                                    }
+                                  ],
+                                  "class": "InitialWorkDirRequirement"
+                                }
+                              ],
+                            "inputs": [
+                                {
+                                    "type": "File",
+                                    "id": "#input_collector.cwl/single_file"
+                                }
+                            ],
+                            "outputs": [
+                                {
+                                    "type": "File",
+                                    "outputBinding": {
+                                        "glob": "*"
+                                    },
+                                    "id": "#input_collector.cwl/output"
+                                }
+                            ],
+                            "baseCommand": [
+                                "echo"
+                            ],
+                            "id": "#input_collector.cwl"
+                        },
+                        {
+                            "class": "Workflow",
+                            "doc": "This is the description of the workflow",
+                            "inputs": [
+                                {
+                                    "type": "File",
+                                    "label": "Single File",
+                                    "doc": "This should allow for single File selection only.",
+                                    "id": "#main/single_file"
+                                }
+                            ],
+                            "outputs": [
+                                {
+                                    "type": "File",
+                                    "outputSource": "#main/input_collector/output",
+                                    "id": "#main/log_file"
+                                }
+                            ],
+                            "steps": [
+                                {
+                                    "run": "#input_collector.cwl",
+                                    "in": [
+                                        {
+                                            "source": "#main/single_file",
+                                            "id": "#main/input_collector/single_file"
+                                        }
+                                    ],
+                                    "out": [
+                                        "#main/input_collector/output"
+                                    ],
+                                    "id": "#main/input_collector"
+                                }
+                            ],
+                            "id": "#main"
+                        }
+                    ]
+                },
+            },
+            '/var/lib/cwl/cwl.input.json': {
+                kind: MountKind.JSON,
+                content: {
+                    "single_file": {
+                        "class": "File",
+                        "location": "keep:233454526794c0a2d56a305baeff3d30+145/1.txt",
+                        "basename": "fileA"
+                      }
+                },
+            }
+        },
+        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=c97qk-j7d0g-s3ngc1z0748hsmf",
+            '/var/lib/cwl/workflow.json#main',
+            '/var/lib/cwl/cwl.input.json'
+        ],
+        outputPath: '/var/spool/cwl',
+        priority: 1,
+    });
+};
+
diff --git a/src/models/container-request.ts b/src/models/container-request.ts
index 78891c7..e65bed9 100644
--- a/src/models/container-request.ts
+++ b/src/models/container-request.ts
@@ -22,7 +22,7 @@ export interface ContainerRequestResource extends Resource {
     requestingContainerUuid: string | null;
     containerUuid: string | null;
     containerCountMax: number;
-    mounts: MountType[];
+    mounts: {[path: string]: MountType};
     runtimeConstraints: RuntimeConstraints;
     schedulingParameters: SchedulingParameters;
     containerImage: string;
diff --git a/src/models/mount-types.ts b/src/models/mount-types.ts
index ec48c85..52b2949 100644
--- a/src/models/mount-types.ts
+++ b/src/models/mount-types.ts
@@ -8,7 +8,7 @@ export enum MountKind {
     TEMPORARY_DIRECTORY = 'tmp',
     KEEP = 'keep',
     MOUNTED_FILE = 'file',
-    JSON = 'JSON'
+    JSON = 'json'
 }
 
 export type MountType =
@@ -16,7 +16,8 @@ export type MountType =
     GitTreeMount |
     TemporaryDirectoryMount |
     KeepMount |
-    JSONMount;
+    JSONMount |
+    FileMount;
 
 export interface CollectionMount {
     kind: MountKind.COLLECTION;
@@ -52,5 +53,10 @@ export interface KeepMount {
 
 export interface JSONMount {
     kind: MountKind.JSON;
-    content: string;
+    content: any;
+}
+
+export interface FileMount {
+    kind: MountKind.MOUNTED_FILE;
+    path: string;
 }
diff --git a/src/models/resource.ts b/src/models/resource.ts
index 698bcf7..b8156cf 100644
--- a/src/models/resource.ts
+++ b/src/models/resource.ts
@@ -40,6 +40,7 @@ export enum ResourceObjectType {
     GROUP = 'j7d0g',
     LOG = '57u5n',
     USER = 'tpzed',
+    WORKFLOW = '7fd4e',
 }
 
 export const RESOURCE_UUID_PATTERN = '.{5}-.{5}-.{15}';
@@ -70,6 +71,8 @@ export const extractUuidKind = (uuid: string = '') => {
             return ResourceKind.CONTAINER;
         case ResourceObjectType.LOG:
             return ResourceKind.LOG;
+        case ResourceObjectType.WORKFLOW:
+            return ResourceKind.WORKFLOW;
         default:
             return undefined;
     }
diff --git a/src/models/runtime-constraints.ts b/src/models/runtime-constraints.ts
index ba90537..a780fd3 100644
--- a/src/models/runtime-constraints.ts
+++ b/src/models/runtime-constraints.ts
@@ -5,6 +5,6 @@
 export interface RuntimeConstraints {
     ram: number;
     vcpus: number;
-    keepCacheRam: number;
+    keepCacheRam?: number;
     API: boolean;
 }
diff --git a/src/services/common-service/common-resource-service.ts b/src/services/common-service/common-resource-service.ts
index f6810c0..0c99e7d 100644
--- a/src/services/common-service/common-resource-service.ts
+++ b/src/services/common-service/common-resource-service.ts
@@ -89,7 +89,7 @@ export class CommonResourceService<T extends Resource> {
         this.actions = actions;
     }
 
-    create(data?: Partial<T> | any) {
+    create(data?: Partial<T>) {
         return CommonResourceService.defaultResponse(
             this.serverApi
                 .post<T>(this.resourceType, data && CommonResourceService.mapKeys(_.snakeCase)(data)),
diff --git a/src/services/container-request-service/container-request-service.ts b/src/services/container-request-service/container-request-service.ts
index e035ed5..2e2ccd1 100644
--- a/src/services/container-request-service/container-request-service.ts
+++ b/src/services/container-request-service/container-request-service.ts
@@ -2,6 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+import { snakeCase } from 'lodash';
 import { CommonResourceService } from "~/services/common-service/common-resource-service";
 import { AxiosInstance } from "axios";
 import { ContainerRequestResource } from '~/models/container-request';
@@ -11,4 +12,25 @@ export class ContainerRequestService extends CommonResourceService<ContainerRequ
     constructor(serverApi: AxiosInstance, actions: ApiActions) {
         super(serverApi, "container_requests", actions);
     }
+
+    create(data?: Partial<ContainerRequestResource>) {
+        if (data) {
+            const { mounts } = data;
+            if (mounts) {
+                const mappedData = {
+                    ...CommonResourceService.mapKeys(snakeCase)(data),
+                    mounts,
+                };
+                return CommonResourceService
+                    .defaultResponse(
+                        this.serverApi.post<ContainerRequestResource>(this.resourceType, mappedData),
+                        this.actions);
+            }
+        }
+        return CommonResourceService
+            .defaultResponse(
+                this.serverApi
+                    .post<ContainerRequestResource>(this.resourceType, data && CommonResourceService.mapKeys(snakeCase)(data)),
+                this.actions);
+    }
 }
diff --git a/src/services/services.ts b/src/services/services.ts
index 9c764b0..d39a68b 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -21,6 +21,7 @@ import { ContainerRequestService } from './container-request-service/container-r
 import { ContainerService } from './container-service/container-service';
 import { LogService } from './log-service/log-service';
 import { ApiActions } from "~/services/api/api-actions";
+import { WorkflowService } from "~/services/workflow-service/workflow-service";
 
 export type ServiceRepository = ReturnType<typeof createServices>;
 
@@ -39,6 +40,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
     const logService = new LogService(apiClient, actions);
     const projectService = new ProjectService(apiClient, actions);
     const userService = new UserService(apiClient, actions);
+    const workflowService = new WorkflowService(apiClient, actions);
 
     const ancestorsService = new AncestorService(groupsService, userService);
     const authService = new AuthService(apiClient, config.rootUrl, actions);
@@ -64,6 +66,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
         tagService,
         userService,
         webdavClient,
+        workflowService,
     };
 };
 
diff --git a/src/services/container-request-service/container-request-service.ts b/src/services/workflow-service/workflow-service.ts
similarity index 52%
copy from src/services/container-request-service/container-request-service.ts
copy to src/services/workflow-service/workflow-service.ts
index e035ed5..57ad5fa 100644
--- a/src/services/container-request-service/container-request-service.ts
+++ b/src/services/workflow-service/workflow-service.ts
@@ -2,13 +2,13 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { CommonResourceService } from "~/services/common-service/common-resource-service";
 import { AxiosInstance } from "axios";
-import { ContainerRequestResource } from '~/models/container-request';
-import { ApiActions } from "~/services/api/api-actions";
+import { CommonResourceService } from "~/services/common-service/common-resource-service";
+import { WorkflowResource } from '~/models/workflow';
+import { ApiActions } from '~/services/api/api-actions';
 
-export class ContainerRequestService extends CommonResourceService<ContainerRequestResource> {
+export class WorkflowService extends CommonResourceService<WorkflowResource> {
     constructor(serverApi: AxiosInstance, actions: ApiActions) {
-        super(serverApi, "container_requests", actions);
+        super(serverApi, "workflows", actions);
     }
 }

commit c4f468fdc1ad395fdbe758de4b47522df24d57cc
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Thu Sep 27 09:30:14 2018 +0200

    Install js-yaml, change default api host
    
    Feature #running
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/.env b/.env
index ed397c5..bd41008 100644
--- a/.env
+++ b/.env
@@ -3,5 +3,5 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 REACT_APP_ARVADOS_CONFIG_URL=/config.json
-REACT_APP_ARVADOS_API_HOST=qr1hi.arvadosapi.com
+REACT_APP_ARVADOS_API_HOST=c97qk.arvadosapi.com
 HTTPS=true
\ No newline at end of file
diff --git a/package.json b/package.json
index 811e4a0..a15f417 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
   "dependencies": {
     "@material-ui/core": "1.5.0",
     "@material-ui/icons": "2.0.2",
+    "@types/js-yaml": "3.11.2",
     "@types/lodash": "4.14.116",
     "@types/react-copy-to-clipboard": "4.2.6",
     "@types/react-dropzone": "4.2.2",
@@ -12,6 +13,7 @@
     "@types/shell-quote": "1.6.0",
     "axios": "0.18.0",
     "classnames": "2.2.6",
+    "js-yaml": "3.12.0",
     "lodash": "4.17.10",
     "react": "16.4.2",
     "react-copy-to-clipboard": "5.0.1",
diff --git a/yarn.lock b/yarn.lock
index c814843..230e9f9 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -97,6 +97,10 @@
   version "23.3.1"
   resolved "https://registry.yarnpkg.com/@types/jest/-/jest-23.3.1.tgz#a4319aedb071d478e6f407d1c4578ec8156829cf"
 
+"@types/js-yaml at 3.11.2":
+  version "3.11.2"
+  resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.11.2.tgz#699ad86054cc20043c30d66a6fcde30bbf5d3d5e"
+
 "@types/jss@^9.5.3":
   version "9.5.4"
   resolved "https://registry.yarnpkg.com/@types/jss/-/jss-9.5.4.tgz#89a4ee32a14a8d2937187b1a7f443750e964a74d"
@@ -4328,7 +4332,7 @@ js-tokens@^3.0.0, js-tokens@^3.0.2:
   version "4.0.0"
   resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
 
-js-yaml@^3.4.3, js-yaml@^3.7.0:
+js-yaml at 3.12.0, js-yaml@^3.4.3, js-yaml@^3.7.0:
   version "3.12.0"
   resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
   dependencies:

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list