You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by pp...@apache.org on 2022/05/24 20:26:35 UTC

[incubator-datalab] branch DATALAB-2802 created (now b610074c8)

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

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


      at b610074c8 [DATALAB-2802] Verification start of notebook instance

This branch includes the following new commits:

     new b610074c8 [DATALAB-2802] Verification start of notebook instance

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-2802] Verification start of notebook instance

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

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

commit b610074c8c5918c220957f175d8a4435a1263d8d
Author: Pavel Papou <pp...@gmail.com>
AuthorDate: Tue May 24 16:23:04 2022 -0400

    [DATALAB-2802] Verification start of notebook instance
    
     - the scheduler verevication for edge node
---
 .../src/main/java/com/epam/datalab/backendapi/dao/EnvDAO.java       | 6 ++++++
 .../datalab/backendapi/service/impl/ExploratoryServiceImpl.java     | 5 +----
 .../datalab/backendapi/service/impl/SchedulerJobServiceImpl.java    | 6 +++++-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/dao/EnvDAO.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/dao/EnvDAO.java
index 1e03de1c4..b7f0bfd8d 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/dao/EnvDAO.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/dao/EnvDAO.java
@@ -44,6 +44,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
+import java.util.function.Consumer;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
@@ -319,6 +320,11 @@ public class EnvDAO extends BaseDAO {
 
     }
 
+    public Boolean isEdgeNodeStopped(String user) {
+        LOGGER.trace("Verify if the edge node is stopped for user {}", user);
+        return getEdgeNode(user).map(edge -> edge.getString(EDGE_STATUS)).equals("stopped");
+    }
+
     private void updateEdgeStatus(String user, Document edge, String instanceId, EnvResource r) {
         final String oldStatus = edge.getString(EDGE_STATUS);
         LOGGER.trace("Update EDGE status for user {} with instance_id {} from {} to {}",
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 60d4c84e4..ff6c66023 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
@@ -22,10 +22,7 @@ package com.epam.datalab.backendapi.service.impl;
 import com.epam.datalab.auth.UserInfo;
 import com.epam.datalab.backendapi.annotation.*;
 import com.epam.datalab.backendapi.conf.SelfServiceApplicationConfiguration;
-import com.epam.datalab.backendapi.dao.ComputationalDAO;
-import com.epam.datalab.backendapi.dao.ExploratoryDAO;
-import com.epam.datalab.backendapi.dao.GitCredsDAO;
-import com.epam.datalab.backendapi.dao.ImageExploratoryDAO;
+import com.epam.datalab.backendapi.dao.*;
 import com.epam.datalab.backendapi.domain.*;
 import com.epam.datalab.backendapi.resources.dto.ExploratoryCreatePopUp;
 import com.epam.datalab.backendapi.service.*;
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/SchedulerJobServiceImpl.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/SchedulerJobServiceImpl.java
index 546a0444a..9fc6e7e00 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/SchedulerJobServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/SchedulerJobServiceImpl.java
@@ -264,7 +264,11 @@ public class SchedulerJobServiceImpl implements SchedulerJobService {
         final String user = schedulerJobData.getUser();
         final String exploratoryName = schedulerJobData.getExploratoryName();
         final String project = schedulerJobData.getProject();
-        log.debug("Starting exploratory {} for user {} by scheduler", exploratoryName, user);
+        log.debug("Trying to start the exploratory {} for user {} by scheduler", exploratoryName, user);
+        if (!envDAO.isEdgeNodeStopped(user)) {
+            log.warn("The edge node of {} is not started for user {}", exploratoryName, user);
+            return;
+        }
         exploratoryService.start(securityService.getServiceAccountInfo(user), exploratoryName, project, String.format(AUDIT_MESSAGE, exploratoryName));
         if (schedulerJobData.getJobDTO().isSyncStartRequired()) {
             log.trace("Starting computational for exploratory {} for user {} by scheduler", exploratoryName, user);


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