[ARVADOS-WORKBENCH2] created: 1.2.0-222-gf5fe24a

Git user git at public.curoverse.com
Fri Aug 31 05:58:39 EDT 2018


        at  f5fe24ad520eeaf487a5f68addda0c9f64be1fe6 (commit)


commit f5fe24ad520eeaf487a5f68addda0c9f64be1fe6
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Aug 31 11:58:27 2018 +0200

    Create logs service
    
    Feature #14100
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/models/log.ts b/src/models/log.ts
new file mode 100644
index 0000000..2988656
--- /dev/null
+++ b/src/models/log.ts
@@ -0,0 +1,28 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Resource } from "./resource";
+import { ResourceKind } from '~/models/resource';
+
+export enum LogEventType {
+    CREATE = 'create',
+    UPDATE = 'update',
+    DISPATCH = 'dispatch',
+    CRUNCH_RUN = 'crunch-run',
+    CRUNCHSTAT = 'crunchstat',
+    HOSTSTAT = 'hoststat',
+    NODE_INFO = 'node-info',
+    ARV_MOUNT = 'arv-mount',
+    STDOUT = 'stdout',
+    STDERR = 'stderr',
+}
+
+export interface LogResource extends Resource {
+    kind: ResourceKind.LOG;
+    objectUuid: string;
+    eventAt: string;
+    eventType: string;
+    summary: string;
+    properties: any;
+}
diff --git a/src/models/resource.ts b/src/models/resource.ts
index 3290bdf..3c6c11b 100644
--- a/src/models/resource.ts
+++ b/src/models/resource.ts
@@ -19,6 +19,7 @@ export enum ResourceKind {
     CONTAINER = "arvados#container",
     CONTAINER_REQUEST = "arvados#containerRequest",
     GROUP = "arvados#group",
+    LOG = "arvados#log",
     PROCESS = "arvados#containerRequest",
     PROJECT = "arvados#group",
     USER = "arvados#user",
@@ -30,6 +31,7 @@ export enum ResourceObjectType {
     CONTAINER = 'dz642',
     CONTAINER_REQUEST = 'xvhdp',
     GROUP = 'j7d0g',
+    LOG = '57u5n',
     USER = 'tpzed',
 }
 
@@ -59,6 +61,8 @@ export const extractUuidKind = (uuid: string = '') => {
             return ResourceKind.CONTAINER_REQUEST;
         case ResourceObjectType.CONTAINER:
             return ResourceKind.CONTAINER;
+        case ResourceObjectType.LOG:
+            return ResourceKind.LOG;
         default:
             return undefined;
     }
diff --git a/src/services/log-service/log-service.ts b/src/services/log-service/log-service.ts
new file mode 100644
index 0000000..c92475d
--- /dev/null
+++ b/src/services/log-service/log-service.ts
@@ -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 { LogResource } from '~/models/log';
+
+export class LogService extends CommonResourceService<LogResource> {
+    constructor(serverApi: AxiosInstance) {
+        super(serverApi, "logs");
+    }
+}
diff --git a/src/services/services.ts b/src/services/services.ts
index 32e7bd1..53721dd 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -19,6 +19,7 @@ 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';
+import { LogService } from './log-service/log-service';
 
 export type ServiceRepository = ReturnType<typeof createServices>;
 
@@ -29,13 +30,14 @@ export const createServices = (config: Config) => {
     const webdavClient = new WebDAV();
     webdavClient.defaults.baseURL = config.keepWebServiceUrl;
 
+    const containerRequestService = new ContainerRequestService(apiClient);
+    const containerService = new ContainerService(apiClient);
     const groupsService = new GroupsService(apiClient);
     const keepService = new KeepService(apiClient);
     const linkService = new LinkService(apiClient);
+    const logService = new LogService(apiClient);
     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);
@@ -56,6 +58,7 @@ export const createServices = (config: Config) => {
         groupsService,
         keepService,
         linkService,
+        logService,
         projectService,
         tagService,
         userService,
diff --git a/src/websocket/resource-event-message.ts b/src/websocket/resource-event-message.ts
index 274b2e1..05553bd 100644
--- a/src/websocket/resource-event-message.ts
+++ b/src/websocket/resource-event-message.ts
@@ -1,18 +1,11 @@
+import { LogEventType } from '../models/log';
 // Copyright (C) The Arvados Authors. All rights reserved.
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-export enum ResourceEventMessageType {
-    CREATE = 'create',
-    UPDATE = 'update',
-    HOTSTAT = 'hotstat',
-    CRUNCH_RUN = 'crunch-run',
-    NODE_INFO = 'node-info',
-}
-
 export interface ResourceEventMessage {
     eventAt: string;
-    eventType: ResourceEventMessageType;
+    eventType: LogEventType;
     id: string;
     msgID: string;
     objectKind: string;
diff --git a/src/websocket/websocket.ts b/src/websocket/websocket.ts
index d7072d7..9ee2d17 100644
--- a/src/websocket/websocket.ts
+++ b/src/websocket/websocket.ts
@@ -6,11 +6,12 @@ import { RootStore } from '~/store/store';
 import { AuthService } from '~/services/auth-service/auth-service';
 import { Config } from '~/common/config';
 import { WebSocketService } from './websocket-service';
-import { ResourceEventMessage, ResourceEventMessageType } from './resource-event-message';
+import { ResourceEventMessage } from './resource-event-message';
 import { ResourceKind } from '~/models/resource';
 import { loadProcess } from '~/store/processes/processes-actions';
 import { loadContainers } from '../store/processes/processes-actions';
 import { FilterBuilder } from '~/common/api/filter-builder';
+import { LogEventType } from '../models/log';
 
 export const initWebSocket = (config: Config, authService: AuthService, store: RootStore) => {
     const webSocketService = new WebSocketService(config.websocketUrl, authService);
@@ -19,7 +20,7 @@ export const initWebSocket = (config: Config, authService: AuthService, store: R
 };
 
 const messageListener = (store: RootStore) => (message: ResourceEventMessage) => {
-    if (message.eventType === ResourceEventMessageType.CREATE || message.eventType === ResourceEventMessageType.UPDATE) {
+    if (message.eventType === LogEventType.CREATE || message.eventType === LogEventType.UPDATE) {
         switch (message.objectKind) {
             case ResourceKind.CONTAINER_REQUEST:
                 return store.dispatch(loadProcess(message.objectUuid));

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list