Commit 375b9b87 authored by Mohamed Khalil Labidi's avatar Mohamed Khalil Labidi
Browse files

Fix scale out endpoint when no deployments are found

parent f194bc6a
Pipeline #13691 passed with stage
in 1 minute and 5 seconds
......@@ -859,6 +859,7 @@ public class PAGateway {
LOGGER.error(String.format("Job [%s] not found", jobId));
return 1;
}
EntityManagerHelper.refresh(optJob.get());
// Let's find the task:
Optional<Task> optTask = Optional.ofNullable(optJob.get().findTask(taskName));
......@@ -868,8 +869,7 @@ public class PAGateway {
}
// Let's retrieve the deployment to clone
Optional<Deployment> optDeployment = Optional.ofNullable(optTask.get().getDeployments().get(0));
if (!optDeployment.isPresent()) {
if (optTask.get().getDeployments() == null || optTask.get().getDeployments().isEmpty()) {
LOGGER.error(String.format("No previous deployment found in task [%s] ",taskName));
return 2;
}
......@@ -878,7 +878,7 @@ public class PAGateway {
List<Long> newNodesNumbers = new LinkedList<>();
// Let's clone the deployment/node as needed
Deployment oldDeployment = optDeployment.get();
Deployment oldDeployment = optTask.get().getDeployments().get(0);
nodeNames.stream().map(nodeName -> {
EmsDeploymentRequest newEmsDeploymentReq =
oldDeployment.getEmsDeployment() == null ? null : oldDeployment.getEmsDeployment().clone(nodeName);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment