Commit 095497ce authored by Mohamed Khalil Labidi's avatar Mohamed Khalil Labidi
Browse files

Improve workflow mandatory dependencies calculation

parent 45b079cb
......@@ -779,6 +779,8 @@ public class PAGateway {
if (task.getDeployments() == null || task.getDeployments().isEmpty()) {
LOGGER.warn("The task " + task.getName() + " does not have a deployment. It will be scheduled on any free node.");
scriptTasks.addAll(createAppTasks(task, "", ""));
task.setDeploymentFirstSubmittedTaskName(scriptTasks.get(0).getName());
task.setDeploymentLastSubmittedTaskName(scriptTasks.get(scriptTasks.size()-1).getName());
}
else {
task.getDeployments().forEach(deployment -> {
......@@ -792,9 +794,13 @@ public class PAGateway {
deployment.setIsDeployed(true);
});
task.setDeploymentFirstSubmittedTaskName(scriptTasks.get(0).getName().substring(0, scriptTasks.get(0).getName().lastIndexOf("_0")));
tasksTokens.forEach(taskToken -> {
String suffix = "_" + tasksTokens.indexOf(taskToken);
scriptTasks.addAll(0, createAppTasks(task, suffix, taskToken));
List<ScriptTask> appTasks = createAppTasks(task, suffix, taskToken);
task.setDeploymentLastSubmittedTaskName(appTasks.get(appTasks.size()-1).getName().substring(0, appTasks.get(appTasks.size()-1).getName().lastIndexOf(suffix)));
scriptTasks.addAll(0, appTasks);
if (task.getInstallation().getOperatingSystemType().getOperatingSystemFamily().toLowerCase(Locale.ROOT).equals("ubuntu") &&
task.getInstallation().getOperatingSystemType().getOperatingSystemVersion() < 2000) {
......@@ -827,8 +833,11 @@ public class PAGateway {
paJob.getTasks().forEach(paTask -> {
paJob.getTasks().forEach(paParentTask -> {
if (paTask.getName().contains(task.getName()) && paParentTask.getName().contains(parentTaskName)) {
if (paTask.getName().contains(task.getDeploymentFirstSubmittedTaskName()) &&
paParentTask.getName().contains(jobToSubmit.findTask(parentTaskName).getDeploymentLastSubmittedTaskName())) {
paTask.addDependence(paParentTask);
}
}
});
});
});
......
......@@ -53,6 +53,12 @@ public class Task implements Serializable {
@ElementCollection(targetClass=String.class)
private List<String> submittedTaskNames;
@Column(name = "DEPLOYMENT_FIRST_SUBMITTED_TASK_NAME")
private String deploymentFirstSubmittedTaskName;
@Column(name = "DEPLOYMENT_LAST_SUBMITTED_TASK_NAME")
private String deploymentLastSubmittedTaskName;
public void addDeployment(Deployment deployment) {
if (deployments==null){
deployments = new LinkedList<>();
......
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