Commit 45b079cb authored by Mohamed Khalil Labidi's avatar Mohamed Khalil Labidi
Browse files

Restrict waiting task process to ubuntu < 20.00 versions

parent 86e23465
......@@ -45,6 +45,7 @@ dependencies {
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.1'
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-csv', version: '2.12.1'
compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.common', version: '2.20.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'
annotationProcessor "org.projectlombok:lombok:1.18.12"
}
......@@ -95,6 +95,12 @@
<version>2.12.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......
......@@ -245,6 +245,12 @@ public class PAGateway {
commands.setPreStop(installation.optString("preStop"));
commands.setStop(installation.optString("stop"));
commands.setPostStop(installation.optString("postStop"));
OperatingSystemType operatingSystemType = new OperatingSystemType();
operatingSystemType.setOperatingSystemFamily(installation.optJSONObject("operatingSystem")
.optString("operatingSystemFamily"));
operatingSystemType.setOperatingSystemVersion(installation.optJSONObject("operatingSystem")
.optFloat("operatingSystemVersion"));
commands.setOperatingSystemType(operatingSystemType);
newTask.setInstallation(commands);
break;
case "spark":
......@@ -633,7 +639,6 @@ public class PAGateway {
} else {
try {
nodeConfigJson += "\", \"portToOpens\": " + mapper.writeValueAsString(task.getPortsToOpen()) + "}";
;
} catch (IOException e) {
LOGGER.error(e.getStackTrace());
}
......@@ -791,11 +796,20 @@ public class PAGateway {
String suffix = "_" + tasksTokens.indexOf(taskToken);
scriptTasks.addAll(0, createAppTasks(task, suffix, taskToken));
scriptTasks.add(0, createLockHandlerTask(task.getName(), suffix, taskToken));
scriptTasks.get(1).addDependence(scriptTasks.get(0));
if (task.getInstallation().getOperatingSystemType().getOperatingSystemFamily().toLowerCase(Locale.ROOT).equals("ubuntu") &&
task.getInstallation().getOperatingSystemType().getOperatingSystemVersion() < 2000) {
LOGGER.info("Adding apt lock handler task since task: " + task.getName() +
" is meant to be executed in: " +
task.getInstallation().getOperatingSystemType().getOperatingSystemFamily() +
" version: " + task.getInstallation().getOperatingSystemType().getOperatingSystemVersion());
scriptTasks.add(0, createLockHandlerTask(task.getName(), suffix, taskToken));
scriptTasks.get(1).addDependence(scriptTasks.get(0));
}
});
}
scriptTasks.forEach(scriptTask -> task.addSubmittedTaskName(scriptTask.getName()));
return scriptTasks;
}
......@@ -844,7 +858,6 @@ public class PAGateway {
scriptTasks.forEach(scriptTask -> {
try {
paJob.addTask(scriptTask);
task.addSubmittedTaskName(scriptTask.getName());
} catch (UserException e) {
LOGGER.error("Task " + task.getName() + " could not be added due to: " + e.toString());
}
......
......@@ -4,6 +4,7 @@ import lombok.*;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Embedded;
@AllArgsConstructor
@NoArgsConstructor
......@@ -41,4 +42,7 @@ public class CommandsInstallation {
@Column(name = "UPDATE_CMD", columnDefinition = "TEXT")
private String updateCmd;
@Embedded
private OperatingSystemType operatingSystemType;
}
package org.activeeon.morphemic.model;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Embeddable;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Getter
@Setter
@Embeddable
public class OperatingSystemType {
@Column(name = "OPERATING_SYSTEM_FAMILY")
private String operatingSystemFamily;
@Column(name = "OPERATING_SYSTEM_VERSION")
private float operatingSystemVersion;
}
Supports Markdown
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