You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by yk...@apache.org on 2021/02/01 14:34:11 UTC

[incubator-datalab] branch DATALAB-2232 updated: DATALAB-2232 -- refactoring GPU for Jupyter.

This is an automated email from the ASF dual-hosted git repository.

ykinash pushed a commit to branch DATALAB-2232
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/DATALAB-2232 by this push:
     new 8d8e207  DATALAB-2232 --  refactoring GPU for Jupyter.
8d8e207 is described below

commit 8d8e20794432ce209373033ce391067c31f23a3f
Author: KinashYurii <ur...@gmail.com>
AuthorDate: Mon Feb 1 16:33:25 2021 +0200

    DATALAB-2232 --  refactoring GPU for Jupyter.
---
 .../dto/imagemetadata/ExploratoryMetadataDTO.java  |   3 +
 .../datalab/model/exploratory/Exploratory.java     |   6 ++
 .../backendapi/resources/ExploratoryResource.java  |   6 +-
 .../resources/dto/ExploratoryCreateFormDTO.java    | 115 +++------------------
 .../service/impl/ExploratoryServiceImpl.java       |   2 +-
 5 files changed, 27 insertions(+), 105 deletions(-)

diff --git a/services/datalab-model/src/main/java/com/epam/datalab/dto/imagemetadata/ExploratoryMetadataDTO.java b/services/datalab-model/src/main/java/com/epam/datalab/dto/imagemetadata/ExploratoryMetadataDTO.java
index 3c961c2..74fa55f 100644
--- a/services/datalab-model/src/main/java/com/epam/datalab/dto/imagemetadata/ExploratoryMetadataDTO.java
+++ b/services/datalab-model/src/main/java/com/epam/datalab/dto/imagemetadata/ExploratoryMetadataDTO.java
@@ -40,6 +40,9 @@ public class ExploratoryMetadataDTO extends ImageMetadataDTO {
     private HashMap<String, List<ComputationalResourceShapeDto>> exploratoryEnvironmentShapes;
     @JsonProperty("request_id")
     private String requestId;
+    //GPU
+    @JsonProperty("gpu_types")
+    private List<ComputationalGPU> computationGPU;
 
     public ExploratoryMetadataDTO(String imageName) {
         this.image = imageName;
diff --git a/services/datalab-model/src/main/java/com/epam/datalab/model/exploratory/Exploratory.java b/services/datalab-model/src/main/java/com/epam/datalab/model/exploratory/Exploratory.java
index 176e6a9..e831bf5 100644
--- a/services/datalab-model/src/main/java/com/epam/datalab/model/exploratory/Exploratory.java
+++ b/services/datalab-model/src/main/java/com/epam/datalab/model/exploratory/Exploratory.java
@@ -20,6 +20,7 @@
 package com.epam.datalab.model.exploratory;
 
 import com.epam.datalab.dto.aws.computational.ClusterConfig;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Builder;
 import lombok.Data;
 
@@ -38,4 +39,9 @@ public class Exploratory {
     private final String project;
     private final String exploratoryTag;
     private final List<ClusterConfig> clusterConfig;
+    private Boolean enabledGPU;
+    private String masterGPUType;
+    private String slaveGPUType;
+    private String masterGPUCount;
+    private String slaveGPUCount;
 }
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ExploratoryResource.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ExploratoryResource.java
index d56148e..2cf6653 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ExploratoryResource.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/ExploratoryResource.java
@@ -87,7 +87,6 @@ public class ExploratoryResource implements ExploratoryAPI {
         }
         String uuid = exploratoryService.create(userInfo, getExploratory(formDTO), formDTO.getProject(), formDTO.getName());
         return Response.ok(uuid).build();
-
     }
 
 
@@ -170,6 +169,11 @@ public class ExploratoryResource implements ExploratoryAPI {
                 .endpoint(formDTO.getEndpoint())
                 .project(formDTO.getProject())
                 .exploratoryTag(formDTO.getExploratoryTag())
+                .enabledGPU(formDTO.getEnabledGPU())
+                .masterGPUCount(formDTO.getMasterGPUCount())
+                .masterGPUType(formDTO.getMasterGPUType())
+                .slaveGPUCount(formDTO.getSlaveGPUCount())
+                .slaveGPUType(formDTO.getSlaveGPUType())
                 .build();
     }
 }
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/dto/ExploratoryCreateFormDTO.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/dto/ExploratoryCreateFormDTO.java
index d703563..a6d3e33 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/dto/ExploratoryCreateFormDTO.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/dto/ExploratoryCreateFormDTO.java
@@ -22,6 +22,7 @@ package com.epam.datalab.backendapi.resources.dto;
 import com.epam.datalab.dto.aws.computational.ClusterConfig;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.google.common.base.MoreObjects;
+import lombok.Data;
 import org.hibernate.validator.constraints.NotBlank;
 
 import java.util.List;
@@ -29,6 +30,7 @@ import java.util.List;
 /**
  * Stores info about new exploratory.
  */
+@Data
 public class ExploratoryCreateFormDTO {
     @NotBlank
     @JsonProperty
@@ -66,113 +68,20 @@ public class ExploratoryCreateFormDTO {
     @JsonProperty("cluster_config")
     private List<ClusterConfig> clusterConfig;
 
-    /**
-     * Returns the image name of notebook.
-     */
-    public String getImage() {
-        return image;
-    }
-
-    /**
-     * Sets the image name of notebook.
-     */
-    public void setImage(String image) {
-        this.image = image;
-    }
-
-    /**
-     * Returns name of template.
-     */
-    public String getTemplateName() {
-        return templateName;
-    }
-
-    /**
-     * Sets name of template.
-     */
-    public void setTemplateName(String templateName) {
-        this.templateName = templateName;
-    }
-
-    /**
-     * Returns name of notebook.
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Sets name of notebook.
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /**
-     * Returns name of shape.
-     */
-    public String getShape() {
-        return shape;
-    }
+    @JsonProperty("gpu_enabled")
+    private Boolean enabledGPU;
 
-    /**
-     * Sets name of shape.
-     */
-    public void setShape(String shape) {
-        this.shape = shape;
-    }
+    @JsonProperty("masterGPUType")
+    private String masterGPUType;
 
-    /**
-     * Returns version.
-     */
-    public String getVersion() {
-        return version;
-    }
+    @JsonProperty("slaveGPUType")
+    private String slaveGPUType;
 
-    /**
-     * Sets version.
-     */
-    public void setVersion(String version) {
-        this.version = version;
-    }
+    @JsonProperty("masterGPUCount")
+    private String masterGPUCount;
 
-    /**
-     * Returns image name from which notebook should be created
-     */
-    public String getImageName() {
-        return imageName;
-    }
-
-    /**
-     * Sets image name from which notebook should be created
-     */
-    public void setImageName(String imageName) {
-        this.imageName = imageName;
-    }
-
-    public List<ClusterConfig> getClusterConfig() {
-        return clusterConfig;
-    }
-
-    public String getProject() {
-        return project;
-    }
-
-    public void setProject(String project) {
-        this.project = project;
-    }
-
-    public String getEndpoint() {
-        return endpoint;
-    }
-
-    public void setEndpoint(String endpoint) {
-        this.endpoint = endpoint;
-    }
-
-    public String getExploratoryTag() {
-        return exploratoryTag;
-    }
+    @JsonProperty("slaveGPUCount")
+    private String slaveGPUCount;
 
     @Override
     public String toString() {
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImpl.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImpl.java
index b87d316..186fc4a 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ExploratoryServiceImpl.java
@@ -404,7 +404,7 @@ public class ExploratoryServiceImpl implements ExploratoryService {
                 .withEndpoint(exploratory.getEndpoint())
                 .withCloudProvider(cloudProvider.toString())
                 .withTags(tagService.getResourceTags(userInfo, exploratory.getEndpoint(), project,
-                        exploratory.getExploratoryTag(), false));
+                        exploratory.getExploratoryTag(), exploratory.getEnabledGPU()));
         if (StringUtils.isNotBlank(exploratory.getImageName())) {
             final List<LibInstallDTO> libInstallDtoList = getImageRelatedLibraries(userInfo, exploratory.getImageName(),
                     project, exploratory.getEndpoint());


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org