Create container service
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 29 Aug 2018 08:49:59 +0000 (10:49 +0200)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Wed, 29 Aug 2018 08:49:59 +0000 (10:49 +0200)
Feature #14099

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

src/models/container.ts [new file with mode: 0644]
src/models/resource.ts
src/services/container-service/container-service.ts [new file with mode: 0644]
src/services/services.ts

diff --git a/src/models/container.ts b/src/models/container.ts
new file mode 100644 (file)
index 0000000..6f847b1
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Resource, ResourceKind } from "./resource";
+
+export enum ContainerState {
+    QUEUED = 'Queued',
+    LOCKED = 'Locked',
+    RUNNING = 'Running',
+    COMPLETE = 'Complete',
+    CANCELLED = 'Cancelled',
+}
+
+export interface ContainerResource extends Resource {
+    kind: ResourceKind.CONTAINER;
+    state: string;
+    startedAt: string;
+    finishedAt: string;
+    log: string;
+    environment: {};
+    cwd: string;
+    command: string[];
+    outputPath: string;
+    mounts: {};
+    runtimeConstraints: {};
+    schedulingParameters: {};
+    output: string;
+    containerImage: string;
+    progress: number;
+    priority: number;
+    exitCode: number;
+    authUuid: string;
+    lockedByUuid: string;
+}
index ec4fe5f9f6ce65eaa681d51e7cc988a375d94f65..3290bdfe06f07ed60fa27accd067cff47f0d0b6b 100644 (file)
@@ -16,19 +16,21 @@ export interface Resource {
 
 export enum ResourceKind {
     COLLECTION = "arvados#collection",
+    CONTAINER = "arvados#container",
     CONTAINER_REQUEST = "arvados#containerRequest",
     GROUP = "arvados#group",
     PROCESS = "arvados#containerRequest",
     PROJECT = "arvados#group",
-    WORKFLOW = "arvados#workflow",
     USER = "arvados#user",
+    WORKFLOW = "arvados#workflow",
 }
 
 export enum ResourceObjectType {
-    USER = 'tpzed',
-    GROUP = 'j7d0g',
     COLLECTION = '4zz18',
-    CONTAINER_REQUEST = 'xvhdp'
+    CONTAINER = 'dz642',
+    CONTAINER_REQUEST = 'xvhdp',
+    GROUP = 'j7d0g',
+    USER = 'tpzed',
 }
 
 export const RESOURCE_UUID_PATTERN = '.{5}-.{5}-.{15}';
@@ -55,6 +57,8 @@ export const extractUuidKind = (uuid: string = '') => {
             return ResourceKind.COLLECTION;
         case ResourceObjectType.CONTAINER_REQUEST:
             return ResourceKind.CONTAINER_REQUEST;
+        case ResourceObjectType.CONTAINER:
+            return ResourceKind.CONTAINER;
         default:
             return undefined;
     }
diff --git a/src/services/container-service/container-service.ts b/src/services/container-service/container-service.ts
new file mode 100644 (file)
index 0000000..698c7f5
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { CommonResourceService } from "~/common/api/common-resource-service";
+import { AxiosInstance } from "axios";
+import { ContainerResource } from '../../models/container';
+
+export class ContainerService extends CommonResourceService<ContainerResource> {
+    constructor(serverApi: AxiosInstance) {
+        super(serverApi, "containers");
+    }
+}
index d73d14b1f89af4555fefb338d80e2e351ad8c87b..32e7bd18b2ff9bd54ee1305af28e132e5da4cfe9 100644 (file)
@@ -18,6 +18,7 @@ import { UserService } from './user-service/user-service';
 import { AncestorService } from "~/services/ancestors-service/ancestors-service";
 import { ResourceKind } from "~/models/resource";
 import { ContainerRequestService } from './container-request-service/container-request-service';
+import { ContainerService } from './container-service/container-service';
 
 export type ServiceRepository = ReturnType<typeof createServices>;
 
@@ -34,6 +35,7 @@ export const createServices = (config: Config) => {
     const projectService = new ProjectService(apiClient);
     const userService = new UserService(apiClient);
     const containerRequestService = new ContainerRequestService(apiClient);
+    const containerService = new ContainerService(apiClient);
     
     const ancestorsService = new AncestorService(groupsService, userService);
     const authService = new AuthService(apiClient, config.rootUrl);
@@ -49,6 +51,7 @@ export const createServices = (config: Config) => {
         collectionFilesService,
         collectionService,
         containerRequestService,
+        containerService,
         favoriteService,
         groupsService,
         keepService,