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 13:26:19 UTC
[incubator-datalab] branch DATALAB-2179 created (now c3a62f1)
This is an automated email from the ASF dual-hosted git repository.
ykinash pushed a change to branch DATALAB-2179
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git.
at c3a62f1 [DATALAB-2179,2318] -- fixed status bugs
This branch includes the following new commits:
new c3a62f1 [DATALAB-2179,2318] -- fixed status bugs
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-2179, 2318] -- fixed status bugs
Posted by yk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ykinash pushed a commit to branch DATALAB-2179
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit c3a62f1f6ac23138f81c113d36fdb9f82168b005
Author: KinashYurii <ur...@gmail.com>
AuthorDate: Mon Jun 14 16:26:03 2021 +0300
[DATALAB-2179,2318] -- fixed status bugs
---
.../computational/AwsComputationalResource.java | 14 +++---
.../resources/ChangePropertiesResource.java | 52 ----------------------
.../resources/aws/ComputationalResourceAws.java | 1 -
.../CheckInfrastructureStatusScheduler.java | 2 +-
.../service/impl/ComputationalServiceImpl.java | 6 ++-
5 files changed, 13 insertions(+), 62 deletions(-)
diff --git a/services/datalab-model/src/main/java/com/epam/datalab/dto/aws/computational/AwsComputationalResource.java b/services/datalab-model/src/main/java/com/epam/datalab/dto/aws/computational/AwsComputationalResource.java
index 8e9f45c..052e08a 100644
--- a/services/datalab-model/src/main/java/com/epam/datalab/dto/aws/computational/AwsComputationalResource.java
+++ b/services/datalab-model/src/main/java/com/epam/datalab/dto/aws/computational/AwsComputationalResource.java
@@ -42,19 +42,19 @@ import java.util.Map;
public class AwsComputationalResource extends UserComputationalResource {
@JsonProperty("instance_id")
- private String instanceId;
+ private final String instanceId;
@JsonProperty("master_node_shape")
- private String masterShape;
+ private final String masterShape;
@JsonProperty("slave_node_shape")
- private String slaveShape;
+ private final String slaveShape;
@JsonProperty("slave_node_spot")
- private Boolean slaveSpot;
+ private final Boolean slaveSpot;
@JsonProperty("slave_node_spot_pct_price")
- private Integer slaveSpotPctPrice;
+ private final Integer slaveSpotPctPrice;
@JsonProperty("total_instance_number")
- private String slaveNumber;
+ private final String slaveNumber;
@JsonProperty("emr_version")
- private String version;
+ private final String version;
@Builder
public AwsComputationalResource(String computationalName, String computationalId, String imageName,
diff --git a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
index f8ff2ff..73ccb3c 100644
--- a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
+++ b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
@@ -20,9 +20,7 @@
package com.epam.datalab.backendapi.resources;
import com.epam.datalab.auth.UserInfo;
-import com.epam.datalab.backendapi.core.response.folderlistener.FolderListener;
import com.epam.datalab.backendapi.core.response.folderlistener.WatchItem;
-import com.epam.datalab.backendapi.core.response.folderlistener.WatchItemList;
import com.epam.datalab.properties.ChangePropertiesConst;
import com.epam.datalab.properties.ChangePropertiesService;
import com.epam.datalab.properties.RestartForm;
@@ -34,10 +32,8 @@ import javax.inject.Inject;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.function.Predicate;
import static com.epam.datalab.backendapi.core.response.folderlistener.WatchItem.ItemStatus.INPROGRESS;
import static com.epam.datalab.backendapi.core.response.folderlistener.WatchItem.ItemStatus.WAIT_FOR_FILE;
@@ -89,55 +85,7 @@ public class ChangePropertiesResource implements ChangePropertiesConst {
@POST
@Path("/restart")
public Response restart(@Auth UserInfo userInfo, RestartForm restartForm) {
-// checkResponseFiles(restartForm);
changePropertiesService.restart(restartForm);
return Response.ok().build();
}
-
- private void checkResponseFiles(RestartForm restartForm) {
- List<WatchItem> watchItems = new ArrayList<>();
- //or check getFileHandlerCallback().getId()/uuid
-
- FolderListener.getListeners().get(0).getItemList().get(0).getFileHandlerCallback().getUUID();
- FolderListener.getListeners().stream()
- .map(FolderListener::getItemList)
- .forEach(
- x -> {
- for (int i = 0; i < x.size(); i++) {
- log.info("TEST LOG!!!" +
- "watchItem:{}, fileHandlerCallBack: {}, uuid: {}",
- x.get(i), x.get(i).getFileHandlerCallback(),
- x.get(i).getFileHandlerCallback().getId());
- }
- }
- );
-
- boolean isNoneFinishedRequests = FolderListener.getListeners().stream()
- .filter(FolderListener::isAlive)
- .filter(FolderListener::isListen)
- .map(FolderListener::getItemList)
- .anyMatch(findAnyInStatus(watchItems, inProgressStatuses));
- if (isNoneFinishedRequests) {
- log.info("Found unchecked response file from docker : {}." +
- " Provisioning restart is denied", watchItems);
- restartForm.setProvserv(false);
- }
-
- }
-
- private Predicate<WatchItemList> findAnyInStatus(List<WatchItem> watchItems,
- List<WatchItem.ItemStatus> statuses) {
- log.info("TEST LOG!!!" +
- "watchItems:{}, statuses to find: {}", watchItems, statuses);
- return watchItemList -> {
- for (int i = 0; i < watchItemList.size(); i++) {
- if (statuses.contains(watchItemList.get(i).getStatus())) {
- log.info("TEST LOG!!!" +
- "watchItem:{}, status: {}", watchItemList.get(i), watchItemList.get(i).getStatus());
- watchItems.add(watchItemList.get(i));
- }
- }
- return !watchItems.isEmpty();
- };
- }
}
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/aws/ComputationalResourceAws.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/aws/ComputationalResourceAws.java
index 3725984..baaf397 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/aws/ComputationalResourceAws.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/resources/aws/ComputationalResourceAws.java
@@ -85,7 +85,6 @@ public class ComputationalResourceAws implements ComputationalAPI {
@Path("dataengine-service")
public Response createDataEngineService(@Auth @Parameter(hidden = true) UserInfo userInfo,
@Parameter @Valid @NotNull AwsComputationalCreateForm form) {
-
log.debug("Create computational resources for {} | form is {}", userInfo.getName(), form);
if (DataEngineType.CLOUD_SERVICE == DataEngineType.fromDockerImageName(form.getImage())) {
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/schedulers/CheckInfrastructureStatusScheduler.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/schedulers/CheckInfrastructureStatusScheduler.java
index 0bc5ec0..808a1f2 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/schedulers/CheckInfrastructureStatusScheduler.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/schedulers/CheckInfrastructureStatusScheduler.java
@@ -51,7 +51,7 @@ public class CheckInfrastructureStatusScheduler implements Job {
private static final List<UserInstanceStatus> statusesToCheck =
Arrays.asList(RUNNING, STARTING, CREATING, CREATING_IMAGE,
- CONFIGURING, STOPPING, RECONFIGURING, STOPPED, TERMINATING);
+ CONFIGURING, STOPPING, RECONFIGURING, STOPPED, TERMINATING, TERMINATED);
private final InfrastructureInfoService infrastructureInfoService;
private final SecurityService securityService;
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImpl.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImpl.java
index de80e1d..b75ff62 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/ComputationalServiceImpl.java
@@ -47,6 +47,7 @@ import com.epam.datalab.rest.contracts.ComputationalAPI;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.inject.name.Named;
+import com.mongodb.client.result.UpdateResult;
import lombok.extern.slf4j.Slf4j;
import java.util.*;
@@ -174,6 +175,7 @@ public class ComputationalServiceImpl implements ComputationalService {
final DataEngineType dataEngineType = compResource.getDataEngineType();
EndpointDTO endpointDTO = endpointService.get(userInstanceDTO.getEndpoint());
ComputationalTerminateDTO dto = requestBuilder.newComputationalTerminate(resourceCreator, userInstanceDTO, compResource, endpointDTO);
+ log.info("!!!TEST LOG!!!: terminate dto: {}", dto);
final String provisioningUrl = Optional.ofNullable(DATA_ENGINE_TYPE_TERMINATE_URLS.get(dataEngineType))
.orElseThrow(UnsupportedOperationException::new);
@@ -346,7 +348,9 @@ public class ComputationalServiceImpl implements ComputationalService {
.withComputationalName(computationalName)
.withStatus(status);
- computationalDAO.updateComputationalStatus(computationalStatus);
+ UpdateResult updateResult = computationalDAO.updateComputationalStatus(computationalStatus);
+ log.info("!!!TEST LOG!!!: after update: {}", updateResult);
+
}
private SparkStandaloneClusterResource createInitialComputationalResource(SparkStandaloneClusterCreateForm form) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org