Commit 27ccb5af authored by Jan Marchel's avatar Jan Marchel
Browse files

Merge remote-tracking branch 'origin/morphemic-rc1.5' into jira_112_bug_fix

# Conflicts:
#	.gitlab-ci.yml
parents 8146371d f6d26ff8
Pipeline #16001 passed with stages
in 47 minutes and 55 seconds
......@@ -7,7 +7,7 @@ variables:
DOCKER_DIND_SERVICE: "$DOCKER_DIND_IMAGE-dind"
DOCKER_DRIVER: overlay
DOCKER_TLS_CERTDIR: "/certs"
MAVEN_OPTS: "-Xmx2048m -Xms2048m"
SKIP_TESTS: "true"
......@@ -34,13 +34,13 @@ variables:
MCTS_SOLVER_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f zpp-solver/mcts-solver/pom.xml"
EMS_CLI: "mvn --batch-mode -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/pom.xml"
# EMS_UTIL_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/util/pom.xml"
# EMS_BROKER_CLIENT_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/broker-client/pom.xml"
# EMS_BROKER_CEP_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/broker-cep/pom.xml"
# EMS_BAGUETTE_CLIENT_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/baguette-client/pom.xml"
# EMS_BAGUETTE_CLIENT_INSTALL_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/baguette-client-install/pom.xml"
# EMS_BAGUETTE_SERVER_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/baguette-server/pom.xml"
# EMS_TRANSLATOR_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/translator/pom.xml"
# EMS_UTIL_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/util/pom.xml"
# EMS_BROKER_CLIENT_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/broker-client/pom.xml"
# EMS_BROKER_CEP_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/broker-cep/pom.xml"
# EMS_BAGUETTE_CLIENT_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/baguette-client/pom.xml"
# EMS_BAGUETTE_CLIENT_INSTALL_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/baguette-client-install/pom.xml"
# EMS_BAGUETTE_SERVER_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/baguette-server/pom.xml"
# EMS_TRANSLATOR_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/translator/pom.xml"
EMS_SERVER_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f event-management/control-service/pom.xml"
METASOLVER_CLI: "mvn --batch-mode -N -Dmaven.test.skip=$SKIP_TESTS -Ddocker.push=false -f meta_solver/pom.xml"
......@@ -56,11 +56,11 @@ cache:
before_script:
- mkdir -p $HOME/.m2
- echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>'$CI_PROJECT_DIR'/maven_repo</localRepository>
</settings>' > $HOME/.m2/settings.xml
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>'$CI_PROJECT_DIR'/maven_repo</localRepository>
</settings>' > $HOME/.m2/settings.xml
- echo "MAVEN_OPTS=$MAVEN_OPTS" > $CI_PROJECT_DIR/.env.list
after_script:
......@@ -76,8 +76,8 @@ stages:
- build-required-part4
- build-required-part5
- build-required-part6
# - build-required-part7
# - build-required-part8
# - build-required-part7
# - build-required-part8
- build
- deploy
- deploy-solvers-part1
......@@ -91,6 +91,7 @@ build-basic-dependencies:melodic-upperware:
script:
- $MELODIC_UPPERWARE_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- /builds/melodic/melodic-upperware/maven_repo/org/ow2/paasage/upperware/
......@@ -100,6 +101,7 @@ build-required-part1:upperware-metamodel:
script:
- $UPPERWARE_METAMODEL_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- /builds/melodic/melodic-upperware/maven_repo/org/ow2/paasage/upperware-metamodel/
......@@ -109,6 +111,7 @@ build-required-part2:jwt-commons:
script:
- $JWT_COMMONS_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- /builds/melodic/melodic-upperware/maven_repo/org/ow2/paasage/jwt-commons/
......@@ -118,6 +121,7 @@ build-required-part2:melodic-commons:
script:
- $MELODIC_COMMONS_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- /builds/melodic/melodic-upperware/maven_repo/org/ow2/paasage/melodic-commons/
......@@ -127,6 +131,7 @@ build-required-part3:melodic-cache:
script:
- $MELODIC_CACHE_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- /builds/melodic/melodic-upperware/maven_repo/org/ow2/paasage/melodic-cache/
......@@ -136,6 +141,7 @@ build-required-part3:zpp-solver:
script:
- $ZPP_SOLVER_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- /builds/melodic/melodic-upperware/maven_repo/org/ow2/paasage/zpp-solver/
......@@ -146,6 +152,7 @@ build-required-part3:ems:
script:
- $EMS_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- $CI_PROJECT_DIR/event-management/bin
- $CI_PROJECT_DIR/event-management/config-files
......@@ -175,6 +182,7 @@ build-required-part5:utility-generator:
script:
- $UTILITY_GENERATOR_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- /builds/melodic/melodic-upperware/maven_repo/eu/melodic/utility-generator/
......@@ -202,6 +210,7 @@ build-required-part6:cp-solver:
script:
- $CP_SOLVER_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- /builds/melodic/melodic-upperware/maven_repo/eu/melodic/cp-solver/
......@@ -247,6 +256,7 @@ build:cp-parser:
script:
- $CP_PARSER_CLI -Pwithout-docker clean install
artifacts:
expire_in: 1 week
paths:
- /builds/melodic/melodic-upperware/maven_repo/eu/melodic/cp-parser/
......@@ -632,7 +642,7 @@ deploy:gui-backend:
- rc3.1
- morphemic-rc1.5
- proactive-dev
- jira_112_bug_fix
- undeploy_application
image: $DOCKER_DIND_IMAGE
services:
- $DOCKER_DIND_SERVICE
......
package eu.melodic.upperware.adapter.communication.proactive;
import cloud.morphemic.connectors.proactive.IProactiveClientServiceConnector;
import org.activeeon.morphemic.model.ByonNode;
import org.activeeon.morphemic.model.SubmittedJobType;
import org.apache.commons.lang3.tuple.Pair;
import org.json.JSONArray;
......@@ -22,4 +23,5 @@ public interface ProactiveClientServiceForAdapter extends IProactiveClientServic
int addMonitors(List<String> nodeNames, String authorizationBearer);
int addByonNodes(Map<String, String> byonIdPerComponent, String jobId);
void waitForJobFinish(String jobId, SubmittedJobType expectedJobType);
List<ByonNode> getByonNodeList(String jobId);
}
......@@ -3,6 +3,7 @@ package eu.melodic.upperware.adapter.communication.proactive;
import cloud.morphemic.connectors.proactive.ProactiveClientServiceConnector;
import eu.melodic.upperware.adapter.exception.AdapterException;
import lombok.extern.slf4j.Slf4j;
import org.activeeon.morphemic.model.ByonNode;
import org.activeeon.morphemic.model.SubmittedJobType;
import org.apache.commons.lang3.tuple.Pair;
import org.json.JSONArray;
......@@ -11,10 +12,7 @@ import org.ow2.proactive.scheduler.common.job.JobState;
import org.ow2.proactive.scheduler.common.job.JobStatus;
import org.springframework.lang.NonNull;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Slf4j
......@@ -146,4 +144,10 @@ public class ProactiveClientServiceForAdapterImpl extends ProactiveClientService
public int addByonNodes(Map<String, String> byonIdPerComponent, String jobId) {
return getPAGateway().map(paGateway -> paGateway.addByonNodes(byonIdPerComponent, jobId)).orElse(-1);
}
@Override
public List<ByonNode> getByonNodeList(String jobId) {
return getPAGateway().map(paGateway -> paGateway.getByonNodeList(jobId)).orElse(Collections.emptyList());
}
}
......@@ -74,7 +74,13 @@ public class NodeTaskExecutor extends RunnableTaskExecutor<AdapterRequirement> {
}
private void addBYONNode(AdapterRequirement taskBody) {
final Map<String, String> byonIdPerComponent = Collections.singletonMap(taskBody.getNodeCandidate().getId(),
String byonId = proactiveClientServiceForAdapter.getByonNodeList(applicationId).stream()
.filter(byonNode -> byonNode.getNodeCandidate().getId().equals(taskBody.getNodeCandidate().getId()))
.findFirst()
.orElseThrow(() -> new AdapterException(String.format("Could not find BYON with associated NodeCandidate id=%s", taskBody.getNodeCandidate().getId())))
.getId();
final Map<String, String> byonIdPerComponent = Collections.singletonMap(byonId,
taskBody.getTaskName());
log.info("NodeTaskExecutor->addBYONNode: [application id: {}] ProActive byonIdPerComponent= {}", applicationId, byonIdPerComponent);
......
package eu.melodic.upperware.guibackend;
import eu.melodic.upperware.guibackend.communication.proactive.ProactiveClientService;
import eu.melodic.upperware.guibackend.communication.proactive.ProactiveClientServiceGUI;
import eu.melodic.upperware.guibackend.communication.proactive.ProactiveClientServiceGUIImpl;
import eu.melodic.upperware.guibackend.communication.proactive.ProactiveClientServiceImpl;
import eu.melodic.upperware.guibackend.domain.converter.*;
import eu.melodic.upperware.guibackend.properties.GuiBackendProperties;
import eu.paasage.upperware.security.authapi.properties.MelodicSecurityProperties;
......@@ -86,6 +88,15 @@ public class ApplicationContext {
};
}
@Bean
public ProactiveClientService proactiveClientService(final GuiBackendProperties guiBackendProperties) {
return new ProactiveClientServiceImpl(guiBackendProperties.getPaConfig().getRestUrl(),
guiBackendProperties.getPaConfig().getLogin(),
guiBackendProperties.getPaConfig().getPassword(),
guiBackendProperties.getPaConfig().getEncryptorPw()) {
};
}
@Bean(name = "locationConverter")
public GenericConverter<?, ?> getLocationConverter() {
return new ProactiveLocationConverter();
......
package eu.melodic.upperware.guibackend.communication.proactive;
import cloud.morphemic.connectors.proactive.IProactiveClientServiceConnector;
public interface ProactiveClientService extends IProactiveClientServiceConnector {
Long stopJob(String jobId);
}
package eu.melodic.upperware.guibackend.communication.proactive;
import cloud.morphemic.connectors.proactive.ProactiveClientServiceConnector;
import eu.melodic.upperware.guibackend.controller.common.UndeployState;
import eu.melodic.upperware.guibackend.controller.process.response.UndeployResponse;
public class ProactiveClientServiceImpl extends ProactiveClientServiceConnector implements ProactiveClientService {
protected ProactiveClientServiceImpl(String restUrl, String login, String password, String encryptorPassword) {
super(restUrl, login, password, encryptorPassword);
}
@Override
public Long stopJob(String jobId) {
return getPAGateway().map(paGateway -> paGateway.stopJob(jobId)).orElse(0L);
}
}
package eu.melodic.upperware.guibackend.controller.common;
public enum UndeployState {
ERROR, UNKNOWN, FINISHED
}
......@@ -12,16 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
......
package eu.melodic.upperware.guibackend.controller.process;
import com.google.gson.JsonObject;
import eu.melodic.models.services.adapter.DifferenceResponse;
import eu.melodic.upperware.guibackend.communication.proactive.ProactiveClientService;
import eu.melodic.upperware.guibackend.communication.proactive.ProactiveClientServiceGUI;
import eu.melodic.upperware.guibackend.controller.process.response.CpModelResponse;
import eu.melodic.upperware.guibackend.controller.process.response.CpSolutionResponse;
import eu.melodic.upperware.guibackend.controller.process.response.ProcessInstanceResponse;
import eu.melodic.upperware.guibackend.controller.process.response.ProcessVariables;
import eu.melodic.upperware.guibackend.controller.common.ProcessState;
import eu.melodic.upperware.guibackend.controller.common.UndeployState;
import eu.melodic.upperware.guibackend.controller.process.response.*;
import eu.melodic.upperware.guibackend.domain.converter.DomainConverterFactory;
import eu.melodic.upperware.guibackend.domain.converter.GenericConverter;
import eu.melodic.upperware.guibackend.service.process.ProcessCamundaService;
import eu.melodic.upperware.guibackend.service.process.ProcessService;
import eu.passage.upperware.commons.model.SecureVariable;
import eu.passage.upperware.commons.model.internal.Cloud;
import eu.passage.upperware.commons.model.internal.Location;
import io.github.cloudiator.rest.model.*;
......@@ -20,6 +22,7 @@ import org.activeeon.morphemic.model.PACloud;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
......@@ -37,6 +40,7 @@ public class ProcessController {
// private CloudiatorApi cloudiatorApi;
private ProcessService processService;
private ProactiveClientServiceGUI proactiveClientServiceGUI;
private ProactiveClientService proactiveClientService;
private final DomainConverterFactory domainConverterFactory;
@GetMapping(value = "/{processId}")
......@@ -191,4 +195,12 @@ public class ProcessController {
log.info("ProcessController->getMonitorsList converted to internal/domain monitors: {}", domains);
return domains;
}
@PostMapping(value = "/deployment/undeploy")
public UndeployResponse undeployApplication(@RequestBody ProcessVariables processVariables) {
log.info("POST request for undeploy of application");
proactiveClientService.stopJob(processVariables.getApplicationId());
log.info("application with id:" + processVariables.getApplicationId() + " stopped");
return new UndeployResponse(UndeployState.FINISHED);
}
}
package eu.melodic.upperware.guibackend.controller.process.response;
import eu.melodic.upperware.guibackend.controller.common.UndeployState;
import lombok.*;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UndeployResponse {
UndeployState state;
}
#
# Copyright (C) 2017-2022 Institute of Communication and Computer Systems (imu.iccs.gr)
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at
# https://www.mozilla.org/en-US/MPL/2.0/
#
*.sh text eol=lf
\ No newline at end of file
......@@ -3,7 +3,7 @@ MetaSolver
Metasolver is used in the Melodic Upperware module for calling and coordinating the reasoning over deployment configurations.
#### Copyright
Copyright (C) 2017-2019 Institute of Communication and Computer Systems (imu.iccs.gr)
Copyright (C) 2017-2022 Institute of Communication and Computer Systems (imu.iccs.gr)
This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at
......
@echo off
::
:: Copyright (C) 2017-2019 Institute of Communication and Computer Systems (imu.iccs.gr)
:: Copyright (C) 2017-2022 Institute of Communication and Computer Systems (imu.iccs.gr)
::
:: This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
:: If a copy of the MPL was not distributed with this file, You can obtain one at
......
<!--
~ Copyright (C) 2017-2019 Institute of Communication and Computer Systems (imu.iccs.gr)
~ Copyright (C) 2017-2022 Institute of Communication and Computer Systems (imu.iccs.gr)
~
~ This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
~ If a copy of the MPL was not distributed with this file, You can obtain one at
......
::
:: Copyright (C) 2017-2019 Institute of Communication and Computer Systems (imu.iccs.gr)
:: Copyright (C) 2017-2022 Institute of Communication and Computer Systems (imu.iccs.gr)
::
:: This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
:: If a copy of the MPL was not distributed with this file, You can obtain one at
......
#!/usr/bin/env bash
#
# Copyright (C) 2017-2019 Institute of Communication and Computer Systems (imu.iccs.gr)
# Copyright (C) 2017-2022 Institute of Communication and Computer Systems (imu.iccs.gr)
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at
......
#
# Copyright (C) 2017-2019 Institute of Communication and Computer Systems (imu.iccs.gr)
# Copyright (C) 2017-2022 Institute of Communication and Computer Systems (imu.iccs.gr)
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at
......
#!/bin/sh
#
# Copyright (C) 2017-2019 Institute of Communication and Computer Systems (imu.iccs.gr)
# Copyright (C) 2017-2022 Institute of Communication and Computer Systems (imu.iccs.gr)
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at
......
/*
* Copyright (C) 2017-2019 Institute of Communication and Computer Systems (imu.iccs.gr)
* Copyright (C) 2017-2022 Institute of Communication and Computer Systems (imu.iccs.gr)
*
* This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at
......
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