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 <[email protected]> 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: [email protected] For additional commands, e-mail: [email protected]
