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/06/14 14:16:58 UTC

[incubator-datalab] branch DATALAB-2437 created (now 0b29efb)

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

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


      at 0b29efb  [DATALAB-2437] -- added slave gpu for user resources

This branch includes the following new commits:

     new 0b29efb  [DATALAB-2437] -- added slave gpu for user resources

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


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


[incubator-datalab] 01/01: [DATALAB-2437] -- added slave gpu for user resources

Posted by yk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0b29efb238b7d5f0febdb5b37470bba507ca659d
Author: KinashYurii <ur...@gmail.com>
AuthorDate: Mon Jun 14 17:16:41 2021 +0300

    [DATALAB-2437] -- added slave gpu for user resources
---
 .../java/com/epam/datalab/dto/UserInstanceDTO.java   | 20 +++++++++++++++-----
 .../dto/computational/UserComputationalResource.java | 12 ++++++++----
 .../gcp/computational/GcpComputationalResource.java  |  6 ++++--
 .../epam/datalab/model/exploratory/Exploratory.java  |  2 ++
 .../backendapi/resources/ExploratoryResource.java    | 11 +++--------
 .../resources/dto/ExploratoryCreateFormDTO.java      |  8 ++++++--
 .../service/impl/ExploratoryServiceImpl.java         |  4 +++-
 7 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/services/datalab-model/src/main/java/com/epam/datalab/dto/UserInstanceDTO.java b/services/datalab-model/src/main/java/com/epam/datalab/dto/UserInstanceDTO.java
index bfa00f7..5d130bb 100644
--- a/services/datalab-model/src/main/java/com/epam/datalab/dto/UserInstanceDTO.java
+++ b/services/datalab-model/src/main/java/com/epam/datalab/dto/UserInstanceDTO.java
@@ -28,11 +28,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
 
 import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Stores info about the user notebook.
@@ -92,6 +88,10 @@ public class UserInstanceDTO {
     private String gpuType;
     @JsonProperty("gpuCount")
     private String gpuCount;
+    @JsonProperty("slave_gpu_type")
+    private String slaveGpuType;
+    @JsonProperty("slave_gpu_count")
+    private String slaveGpuCount;
 
     /**
      * Sets the user login name.
@@ -212,4 +212,14 @@ public class UserInstanceDTO {
         setGpuCount(gpuCount);
         return this;
     }
+
+    public UserInstanceDTO withSlaveGPUType(String slaveGpuType) {
+        setSlaveGpuType(slaveGpuType);
+        return this;
+    }
+
+    public UserInstanceDTO withSlaveGPUCount(String slaveGpuType) {
+        setSlaveGpuCount(slaveGpuType);
+        return this;
+    }
 }
diff --git a/services/datalab-model/src/main/java/com/epam/datalab/dto/computational/UserComputationalResource.java b/services/datalab-model/src/main/java/com/epam/datalab/dto/computational/UserComputationalResource.java
index c845aa1..dbb35e2 100644
--- a/services/datalab-model/src/main/java/com/epam/datalab/dto/computational/UserComputationalResource.java
+++ b/services/datalab-model/src/main/java/com/epam/datalab/dto/computational/UserComputationalResource.java
@@ -74,10 +74,14 @@ public class UserComputationalResource {
     private int totalInstanceCount;
     protected List<ClusterConfig> config;
     private Map<String, String> tags;
-    @JsonProperty("masterGPUType")
-    private String gpuType;
-    @JsonProperty("masterGPUCount")
-    private String gpuCount;
+    @JsonProperty("master_gpu_type")
+    private String masterGpuType;
+    @JsonProperty("master_gpu_count")
+    private String masterGpuCount;
+    @JsonProperty("slave_gpu_type")
+    private String slaveGpuType;
+    @JsonProperty("slave_gpu_count")
+    private String slaveGpuCount;
     private boolean enabledGPU;
 
     public UserComputationalResource(String computationalName, String computationalId, String imageName,
diff --git a/services/datalab-model/src/main/java/com/epam/datalab/dto/gcp/computational/GcpComputationalResource.java b/services/datalab-model/src/main/java/com/epam/datalab/dto/gcp/computational/GcpComputationalResource.java
index 554f3a6..ef13cc1 100644
--- a/services/datalab-model/src/main/java/com/epam/datalab/dto/gcp/computational/GcpComputationalResource.java
+++ b/services/datalab-model/src/main/java/com/epam/datalab/dto/gcp/computational/GcpComputationalResource.java
@@ -88,8 +88,10 @@ public class GcpComputationalResource extends UserComputationalResource {
         this.slaveGPUType = slaveGPUType;
         this.slaveGPUCount = slaveGPUCount;
         this.enabledGPU = enabledGPU;
-        super.setGpuCount(this.masterGPUCount);
-        super.setGpuType(this.masterGPUType);
+        super.setMasterGpuCount(this.masterGPUCount);
+        super.setMasterGpuType(this.masterGPUType);
+        super.setSlaveGpuCount(this.slaveGPUCount);
+        super.setSlaveGpuType(this.slaveGPUType);
         super.setEnabledGPU(enabledGPU);
     }
 }
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 1414dd4..414ea86 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
@@ -41,4 +41,6 @@ public class Exploratory {
     private Boolean enabledGPU;
     private String gpuType;
     private String gpuCount;
+    private String slaveGpuType;
+    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 ba5a41c..33d0d0d 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
@@ -35,14 +35,7 @@ import lombok.extern.slf4j.Slf4j;
 
 import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
+import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import java.util.List;
@@ -172,6 +165,8 @@ public class ExploratoryResource implements ExploratoryAPI {
                 .exploratoryTag(formDTO.getExploratoryTag())
                 .gpuType(formDTO.getGpuType())
                 .gpuCount(formDTO.getGpuCount())
+                .slaveGpuCount(formDTO.getSlaveGpuCount())
+                .slaveGpuType(formDTO.getSlaveGpuType())
                 .enabledGPU(formDTO.getEnabledGPU())
                 .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 0d80ff5..ba0a804 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
@@ -61,10 +61,14 @@ public class ExploratoryCreateFormDTO {
     private List<ClusterConfig> clusterConfig;
     @JsonProperty("gpu_enabled")
     private Boolean enabledGPU;
-    @JsonProperty("gpuType")
+    @JsonProperty("gpu_type")
     private String gpuType;
-    @JsonProperty("gpuCount")
+    @JsonProperty("gpu_count")
     private String gpuCount;
+    @JsonProperty("slave_gpu_type")
+    private String slaveGpuType;
+    @JsonProperty("slave_gpu_count")
+    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 ade4807..bfa7b2f 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
@@ -407,7 +407,9 @@ public class ExploratoryServiceImpl implements ExploratoryService {
                         exploratory.getExploratoryTag(), exploratory.getEnabledGPU()))
                 .withGPUCount(exploratory.getGpuCount())
                 .withGPUEnabled(exploratory.getEnabledGPU())
-                .withGPUType(exploratory.getGpuType());
+                .withGPUType(exploratory.getGpuType())
+                .withSlaveGPUCount(exploratory.getSlaveGpuCount())
+                .withSlaveGPUType(exploratory.getSlaveGpuType());
         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