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/07/02 10:43:55 UTC

[incubator-datalab] branch DATALAB-2195 created (now cbd18d5)

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

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


      at cbd18d5  [DATALAB] -- fixed bugs with statuses

This branch includes the following new commits:

     new cbd18d5  [DATALAB] -- fixed bugs with statuses

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] -- fixed bugs with statuses

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

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

commit cbd18d53df4c8caf9b2271b0c01dc5c0502035d1
Author: KinashYurii <ur...@gmail.com>
AuthorDate: Fri Jul 2 13:42:55 2021 +0300

    [DATALAB] -- fixed bugs with statuses
---
 .../com/epam/datalab/model/exploratory/Exploratory.java     |  2 +-
 .../datalab/backendapi/resources/ExploratoryResource.java   |  4 ++--
 .../java/com/epam/datalab/backendapi/roles/UserRoles.java   |  2 --
 .../backendapi/service/impl/ExploratoryServiceImpl.java     | 13 +++++++++++++
 4 files changed, 16 insertions(+), 5 deletions(-)

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..31c0e65 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
@@ -33,7 +33,7 @@ public class Exploratory {
     private final String version;
     private final String templateName;
     private final String shape;
-    private final String imageName;
+    private String imageName;
     private final String endpoint;
     private final String project;
     private final String exploratoryTag;
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 23b74a6..39bfb89 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
@@ -78,6 +78,7 @@ public class ExploratoryResource implements ExploratoryAPI {
             log.warn("Unauthorized attempt to create a {} by user {}", formDTO.getImage(), userInfo.getName());
             throw new DatalabException("You do not have the privileges to create a " + formDTO.getTemplateName());
         }
+
         String uuid = exploratoryService.create(userInfo, getExploratory(formDTO), formDTO.getProject(), formDTO.getName());
         return Response.ok(uuid).build();
 
@@ -155,8 +156,7 @@ public class ExploratoryResource implements ExploratoryAPI {
         return Exploratory.builder()
                 .name(formDTO.getName())
                 .dockerImage(formDTO.getImage())
-                .imageName((formDTO.getImageName() == null || formDTO.getImageName().isEmpty())
-                        ? formDTO.getVersion() : formDTO.getImageName())
+                .imageName(formDTO.getImageName())
                 .templateName(formDTO.getTemplateName())
                 .version(formDTO.getVersion())
                 .clusterConfig(formDTO.getClusterConfig())
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/roles/UserRoles.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/roles/UserRoles.java
index ef161bf..126e465 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/roles/UserRoles.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/roles/UserRoles.java
@@ -261,8 +261,6 @@ public class UserRoles {
         if (userRoles == null) {
             return true;
         }
-        LOGGER.info("Check access for user {} with groups {} to {}/{}", userInfo.getName(), userInfo.getRoles(),
-                type, name);
         Set<String> groups = getGroups(type, name);
         if (groups == null || groups.isEmpty()) {
             return checkDefault(useDefault);
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 41ce2fd..073e49c 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
@@ -118,6 +118,7 @@ public class ExploratoryServiceImpl implements ExploratoryService {
         try {
             final ProjectDTO projectDTO = projectService.get(project);
             final EndpointDTO endpointDTO = endpointService.get(exploratory.getEndpoint());
+            changeImageNameForDeepLearningOnAWSandAzure(exploratory, endpointDTO);
             final UserInstanceDTO userInstanceDTO = getUserInstanceDTO(userInfo, exploratory, project, endpointDTO.getCloudProvider());
             exploratoryDAO.insertExploratory(userInstanceDTO);
             isAdded = true;
@@ -143,6 +144,18 @@ public class ExploratoryServiceImpl implements ExploratoryService {
         }
     }
 
+    private void changeImageNameForDeepLearningOnAWSandAzure(Exploratory exploratory, EndpointDTO endpointDTO) {
+        if (isDeepLearningOnAwsOrAzure(exploratory, endpointDTO)) {
+            if (exploratory.getImageName() == null || exploratory.getImageName().isEmpty())
+                exploratory.setImageName(exploratory.getVersion());
+        }
+    }
+
+    private boolean isDeepLearningOnAwsOrAzure(Exploratory exploratory, EndpointDTO endpointDTO) {
+        return exploratory.getVersion().equals("Deep Learning AMI (Ubuntu 18.04) Version 42.1") ||
+                exploratory.getVersion().equals("microsoft-dsvm:ubuntu-1804:1804-gen2");
+    }
+
     @Override
     public void updateProjectExploratoryStatuses(UserInfo userInfo, String project, String endpoint, UserInstanceStatus status) {
         exploratoryDAO.fetchProjectExploratoriesWhereStatusNotIn(project, endpoint, TERMINATED, FAILED)

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