diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java index 2041c644e375b18b5722c5bbb41df28236bede82..70fa0245e243c2ed75448a0c90132b95bdb75bab 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java @@ -1,6 +1,7 @@ package org.activeeon.morphemic; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.application.deployment.PAFactory; import org.activeeon.morphemic.application.deployment.PASchedulerGateway; import org.activeeon.morphemic.infrastructure.deployment.PAConnectorIaasGateway; @@ -9,7 +10,7 @@ import org.activeeon.morphemic.model.*; import org.activeeon.morphemic.model.Job; import org.activeeon.morphemic.service.*; import org.apache.commons.lang3.Validate; -import org.apache.log4j.Logger; +//import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONObject; import org.ow2.proactive.resourcemanager.common.event.RMNodeEvent; @@ -35,6 +36,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.stream.IntStream; +@Slf4j public class PAGateway { private final String paURL; @@ -51,7 +53,7 @@ public class PAGateway { private static final String SCRIPTS_SEPARATION_GROOVY = NEW_LINE + NEW_LINE + "// Separation script" + NEW_LINE + NEW_LINE; - private static final Logger LOGGER = Logger.getLogger(PAGateway.class); +// private static final Logger LOGGER = Logger.getLogger(PAGateway.class); /** * Construct a gateway to the ProActive server @@ -73,9 +75,9 @@ public class PAGateway { * @throws RMException In case an error happens in the RM */ public void connect(String username, String password) throws LoginException, KeyException, RMException { - LOGGER.debug("Connecting to ProActive's Resource Manager"); + log.debug("Connecting to ProActive's Resource Manager"); resourceManagerGateway.connect(username, password); - LOGGER.debug("Connecting to ProActive's Scheduler"); + log.debug("Connecting to ProActive's Scheduler"); schedulerGateway.connect(username,password); } @@ -84,9 +86,9 @@ public class PAGateway { * @throws NotConnectedException In case the user is not connected */ public void disconnect() throws NotConnectedException { - LOGGER.debug("Disconnecting from RM..."); + log.debug("Disconnecting from RM..."); resourceManagerGateway.disconnect(); - LOGGER.debug("Disconnecting from Scheduler..."); + log.debug("Disconnecting from Scheduler..."); schedulerGateway.disconnect(); } @@ -151,7 +153,7 @@ public class PAGateway { // if (Objects.equals("PortRequired", portEntry.optString("type")) // && portEntry.optBoolean("isMandatory")) { if (Objects.equals("PortRequired", portEntry.optString("type"))) { - LOGGER.debug("Mandatory required port detected"); + log.debug("Mandatory required port detected"); String providedPortName = findProvidedPort(job, portEntry.optString("name")); parentTasks.add(findTaskByProvidedPort(job.optJSONArray("tasks"), providedPortName)); } @@ -204,7 +206,7 @@ public class PAGateway { // Get the job by jobId from the DB Job applicationJob = EntityManagerHelper.find(Job.class, jobId); - LOGGER.debug("Dot graph creation for the job: "+applicationJob.toString()); + log.debug("Dot graph creation for the job: "+applicationJob.toString()); // Write the dot file header dotGraphSyntax.append("digraph g {\n"); @@ -243,7 +245,7 @@ public class PAGateway { // Write the dot file end character dotGraphSyntax.append("}\n"); - LOGGER.debug("Dot graph created"); + log.debug("Dot graph created"); return dotGraphSyntax.toString(); } @@ -279,7 +281,7 @@ public class PAGateway { installation.optJSONObject("environment").keySet().stream().filter(key -> !key.equals("port")).forEach(key -> vars.put(key, installation.optJSONObject("environment").optString(key))); environment.setEnvironmentVars(vars); newTask.setEnvironment(environment); - LOGGER.info("vars calculated" + vars); + log.info("vars calculated" + vars); case "commands": CommandsInstallation commands = new CommandsInstallation(); commands.setPreInstall(installation.optString("preInstall")); @@ -319,7 +321,7 @@ public class PAGateway { EntityManagerHelper.commit(); - LOGGER.info("Job created: " + newJob.toString()); + log.info("Job created: " + newJob.toString()); } /** @@ -399,7 +401,7 @@ public class PAGateway { variables.put("rm_host_name", endpointPa.getHost()); variables.put("pa_port", "" + endpointPa.getPort()); } catch (MalformedURLException e) { - LOGGER.error(e.getStackTrace()); + log.error(String.valueOf(e.getStackTrace())); } switch (cloud.getCloudProviderName()) { case "aws-ec2": @@ -423,17 +425,17 @@ public class PAGateway { throw new IllegalArgumentException("Spark tasks are not handled yet."); } File fXmlFile = null; - LOGGER.info("NodeSource deployment workflow filename: " + filename); + log.info("NodeSource deployment workflow filename: " + filename); try { fXmlFile = TemporaryFilesHelper.createTempFileFromResource(filename); } catch (IOException ioe) { - LOGGER.error("Opening the NS deployment workflow file failed due to : " + Arrays.toString(ioe.getStackTrace())); + log.error("Opening the NS deployment workflow file failed due to : " + Arrays.toString(ioe.getStackTrace())); } assert fXmlFile != null; - LOGGER.info("Submitting the file: " + fXmlFile.toString()); - LOGGER.info("Trying to deploy the NS: " + nodeSourceName); + log.info("Submitting the file: " + fXmlFile.toString()); + log.info("Trying to deploy the NS: " + nodeSourceName); JobId jobId = schedulerGateway.submit(fXmlFile, variables); - LOGGER.info("Job submitted with ID: " + jobId); + log.info("Job submitted with ID: " + jobId); TemporaryFilesHelper.delete(fXmlFile); } @@ -482,9 +484,9 @@ public class PAGateway { EntityManagerHelper.commit(); } catch (MalformedURLException me) { - LOGGER.error(me.getStackTrace()); + log.error(String.valueOf(me.getStackTrace())); } - LOGGER.info("EMS deployment definition finished."); + log.info("EMS deployment definition finished."); return failedDeploymentIdentification.get(); } @@ -516,19 +518,19 @@ public class PAGateway { cloud.addDeployedRegion(newDeployment.getLocationName(), newDeployment.getLocationName() + "/" + newDeployment.getImageProviderId()); } - LOGGER.info("Node source defined."); + log.info("Node source defined."); - LOGGER.info("Trying to retrieve task: " + node.optString("taskName")); + log.info("Trying to retrieve task: " + node.optString("taskName")); Task task = EntityManagerHelper.find(Job.class, jobId).findTask(node.optString("taskName")); newDeployment.setPaCloud(cloud); newDeployment.setTask(task); newDeployment.setNumber(task.getNextDeploymentID()); EntityManagerHelper.persist(newDeployment); - LOGGER.debug("Deployment created: " + newDeployment.toString()); + log.debug("Deployment created: " + newDeployment.toString()); EntityManagerHelper.persist(cloud); - LOGGER.info("Deployment added to the related cloud: " + cloud.toString()); + log.info("Deployment added to the related cloud: " + cloud.toString()); task.addDeployment(newDeployment); EntityManagerHelper.persist(task); @@ -536,7 +538,7 @@ public class PAGateway { EntityManagerHelper.commit(); - LOGGER.info("Nodes added properly."); + log.info("Nodes added properly."); return 0; } @@ -553,7 +555,7 @@ public class PAGateway { try { resourceManagerGateway.undeployNodeSource(cloud.getNodeSourceNamePrefix() + entry.getKey(), preempt); } catch (NotConnectedException | PermissionRestException e) { - LOGGER.error(e.getStackTrace()); + log.error(String.valueOf(e.getStackTrace())); } } }); @@ -578,24 +580,24 @@ public class PAGateway { EntityManagerHelper.begin(); cloudIDs.forEach(cloudID -> { PACloud cloud = EntityManagerHelper.find(PACloud.class, cloudID); - LOGGER.info("Removing cloud : " + cloud.toString()); + log.info("Removing cloud : " + cloud.toString()); for (Map.Entry entry : cloud.getDeployedRegions().entrySet()) { try { String nodeSourceName = cloud.getNodeSourceNamePrefix() + entry.getKey(); - LOGGER.info("Removing node source " + nodeSourceName + " from the ProActive server."); + log.info("Removing node source " + nodeSourceName + " from the ProActive server."); resourceManagerGateway.removeNodeSource(nodeSourceName, preempt); } catch (NotConnectedException | PermissionRestException e) { - LOGGER.error(e.getStackTrace()); + log.error(String.valueOf(e.getStackTrace())); } } if (cloud.getDeployments() != null) { - LOGGER.info("Cleaning deployments from related tasks " + cloud.getDeployments().toString()); + log.info("Cleaning deployments from related tasks " + cloud.getDeployments().toString()); cloud.getDeployments().forEach(deployment -> deployment.getTask().removeDeployment(deployment)); } - LOGGER.info("Cleaning deployments from the cloud entry"); + log.info("Cleaning deployments from the cloud entry"); cloud.clearDeployments(); EntityManagerHelper.remove(cloud); - LOGGER.info("Cloud removed."); + log.info("Cloud removed."); }); EntityManagerHelper.commit(); } @@ -618,9 +620,9 @@ public class PAGateway { try { String nodeUrl = resourceManagerGateway.searchNodes(Collections.singletonList(nodeName), true).get(0); resourceManagerGateway.removeNode(nodeUrl, preempt); - LOGGER.info("Node " + nodeName + " with URL: " + nodeUrl + " has been removed successfully."); + log.info("Node " + nodeName + " with URL: " + nodeUrl + " has been removed successfully."); } catch (NotConnectedException | RestException e) { - LOGGER.error(e.getStackTrace()); + log.error(String.valueOf(e.getStackTrace())); } }); } @@ -681,13 +683,13 @@ public class PAGateway { newCloud.setDummyInfrastructureName(dummyInfraName); EntityManagerHelper.persist(newCloud); - LOGGER.debug("Cloud created: " + newCloud.toString()); + log.debug("Cloud created: " + newCloud.toString()); savedCloudIds.add(newCloud.getCloudID()); }); EntityManagerHelper.commit(); - LOGGER.info("Clouds created properly."); + log.info("Clouds created properly."); updateNodeCandidatesAsync(savedCloudIds); @@ -799,7 +801,7 @@ public class PAGateway { } private ScriptTask createInfraTask(Task task, Deployment deployment, String taskNameSuffix, String nodeToken) { - LOGGER.debug("Acquiring node AWS script file: " + getClass().getResource(File.separator + "acquire_node_aws_script.groovy").toString()); + log.debug("Acquiring node AWS script file: " + getClass().getResource(File.separator + "acquire_node_aws_script.groovy").toString()); ScriptTask deployNodeTask = PAFactory.createGroovyScriptTaskFromFile("acquireAWSNode_" + task.getName() + taskNameSuffix, "acquire_node_aws_script.groovy"); @@ -810,7 +812,7 @@ public class PAGateway { deployment.getPaCloud().getNodeSourceNamePrefix() + deployment.getLocationName())); variablesMap.put("nVMs", new TaskVariable("nVMs", "1", "PA:Integer", false)); variablesMap.put("synchronous", new TaskVariable("synchronous", "true", "PA:Boolean", false)); - variablesMap.put("timeout", new TaskVariable("timeout", "300", "PA:Long", false)); + variablesMap.put("timeout", new TaskVariable("timeout", "700", "PA:Long", false)); ObjectMapper mapper = new ObjectMapper(); String nodeConfigJson = "{\"image\": \"" + deployment.getLocationName() + "/" + deployment.getImageProviderId() + "\", " + "\"vmType\": \"" + deployment.getHardwareProviderId() + "\", " + @@ -821,19 +823,19 @@ public class PAGateway { try { nodeConfigJson += "\", \"portsToOpen\": " + mapper.writeValueAsString(task.getPortsToOpen()) + "}"; } catch (IOException e) { - LOGGER.error(e.getStackTrace()); + log.error(String.valueOf(e.getStackTrace())); } } variablesMap.put("nodeConfigJson", new TaskVariable("nodeConfigJson", nodeConfigJson, "PA:JSON", false)); variablesMap.put("token", new TaskVariable("token", nodeToken)); - LOGGER.debug("Variables to be added to the task: " + variablesMap.toString()); + log.debug("Variables to be added to the task: " + variablesMap.toString()); deployNodeTask.setVariables(variablesMap); return deployNodeTask; } private ScriptTask createEmsDeploymentTask(EmsDeploymentRequest emsDeploymentRequest, String taskNameSuffix, String nodeToken) { - LOGGER.debug("Preparing EMS deployment task"); + log.debug("Preparing EMS deployment task"); ScriptTask emsDeploymentTask = PAFactory.createComplexScriptTaskFromFiles("emsDeployment" + taskNameSuffix,"emsdeploy_mainscript.groovy","groovy","emsdeploy_prescript.sh","bash","emsdeploy_postscript.sh","bash"); Map variablesMap = emsDeploymentRequest.getWorkflowMap(); emsDeploymentTask.addGenericInformation("NODE_ACCESS_TOKEN", nodeToken); @@ -856,7 +858,7 @@ public class PAGateway { // Let's find the jobId to retrieve the task Optional optJob = Optional.ofNullable(EntityManagerHelper.find(Job.class,jobId)); if (!optJob.isPresent()) { - LOGGER.error(String.format("Job [%s] not found", jobId)); + log.error(String.format("Job [%s] not found", jobId)); return 1; } EntityManagerHelper.refresh(optJob.get()); @@ -864,13 +866,13 @@ public class PAGateway { // Let's find the task: Optional optTask = Optional.ofNullable(optJob.get().findTask(taskName)); if (!optTask.isPresent()) { - LOGGER.error(String.format("Task [%s] not found", taskName)); + log.error(String.format("Task [%s] not found", taskName)); return 1; } // Let's retrieve the deployment to clone if (optTask.get().getDeployments() == null || optTask.get().getDeployments().isEmpty()) { - LOGGER.error(String.format("No previous deployment found in task [%s] ",taskName)); + log.error(String.format("No previous deployment found in task [%s] ",taskName)); return 2; } @@ -918,11 +920,11 @@ public class PAGateway { private void submitScalingOutJob(Job job, String scaledTaskName, List newNodesNumbers) { EntityManagerHelper.refresh(job); - LOGGER.info("Task: " + scaledTaskName + " of job " + job.toString() + " to be scaled out."); + log.info("Task: " + scaledTaskName + " of job " + job.toString() + " to be scaled out."); TaskFlowJob paJob = new TaskFlowJob(); paJob.setName(job.getName() + "_" + scaledTaskName + "_ScaleOut"); - LOGGER.info("Job created: " + paJob.toString()); + log.info("Job created: " + paJob.toString()); EntityManagerHelper.begin(); @@ -944,7 +946,7 @@ public class PAGateway { EntityManagerHelper.persist(job); EntityManagerHelper.commit(); - LOGGER.info("Scaling out of task \'" + scaledTaskName + "\' job, submitted successfully. ID = " + submittedJobId); + log.info("Scaling out of task \'" + scaledTaskName + "\' job, submitted successfully. ID = " + submittedJobId); } private void addAllScriptTasksToPAJob(TaskFlowJob paJob, Task task, List scriptTasks) { @@ -952,7 +954,7 @@ public class PAGateway { try { paJob.addTask(scriptTask); } catch (UserException e) { - LOGGER.error("Task " + task.getName() + " could not be added due to: " + e.toString()); + log.error("Task " + task.getName() + " could not be added due to: " + e.toString()); } }); } @@ -1003,11 +1005,11 @@ public class PAGateway { if (scaledTask.getParentTasks().contains(task.getName())) { // When the scaled task is a child the task to be built - LOGGER.info("Building task " + task.getName() + " as a parent of task " + scaledTaskName); + log.info("Building task " + task.getName() + " as a parent of task " + scaledTaskName); scriptTasks.addAll(createParentScaledTask(task, job)); } else { // Using buildScalingInPATask because it handles all the remaining cases - LOGGER.info("Moving to building with buildScalingInPATask() method"); + log.info("Moving to building with buildScalingInPATask() method"); scriptTasks.addAll(buildScalingInPATask(task, job, scaledTaskName)); } @@ -1080,7 +1082,7 @@ public class PAGateway { emsScriptTask.addDependence(scriptTasks.get(scriptTasks.size()-1)); scriptTasks.add(emsScriptTask); }); - LOGGER.info("Token added: " + token); + log.info("Token added: " + token); deployment.setIsDeployed(true); deployment.setNodeAccessToken(token); @@ -1160,21 +1162,22 @@ public class PAGateway { // Let's find the jobId to retrieve the task Optional optJob = Optional.ofNullable(EntityManagerHelper.find(Job.class,jobId)); if (!optJob.isPresent()) { - LOGGER.error(String.format("Job [%s] not found", jobId)); - return 1; + log.error(String.format("Job [%s] not found", jobId)); + throw new NotFoundException("Job " + jobId + " not found"); } + EntityManagerHelper.refresh(optJob.get()); // Let's find the task: Optional optTask = Optional.ofNullable(optJob.get().findTask(taskName)); if (!optTask.isPresent()) { - LOGGER.error(String.format("Task [%s] not found", taskName)); - return 1; + log.error(String.format("Task [%s] not found", taskName)); + throw new NotFoundException("Task " + taskName + " not found"); } // Validating there will still be at least one deployment in the task if (optTask.get().getDeployments().size() - nodeNames.size() < 1) { - LOGGER.error("I stop the scale-in: the task will loose its last deployment"); - return 2; + log.error("I stop the scale-in: the task will loose its last deployment"); + throw new IllegalArgumentException("Task would loose its last deployment."); } // For supplied node, I retrieve their deployment @@ -1182,7 +1185,7 @@ public class PAGateway { // For deployed node, I flag their removal List nodesToBeRemoved = deployments.stream().filter(Deployment::getIsDeployed).map(Deployment::getNodeName).collect(Collectors.toList()); - LOGGER.info("Nodes to be removed are : " + nodesToBeRemoved); + log.info("Nodes to be removed are : " + nodesToBeRemoved); // For every node, I remove the deployment entree deployments.forEach( deployment -> { @@ -1206,11 +1209,11 @@ public class PAGateway { private void submitScalingInJob(Job job, String scaledTaskName) { EntityManagerHelper.refresh(job); - LOGGER.info("Task: " + scaledTaskName + " of job " + job.toString() + " to be scaled in."); + log.info("Task: " + scaledTaskName + " of job " + job.toString() + " to be scaled in."); TaskFlowJob paJob = new TaskFlowJob(); paJob.setName(job.getName() + "_" + scaledTaskName + "_ScaleIn"); - LOGGER.info("Job created: " + paJob.toString()); + log.info("Job created: " + paJob.toString()); EntityManagerHelper.begin(); @@ -1232,7 +1235,7 @@ public class PAGateway { EntityManagerHelper.persist(job); EntityManagerHelper.commit(); - LOGGER.info("Scaling out of task \'" + scaledTaskName + "\' job, submitted successfully. ID = " + submittedJobId); + log.info("Scaling out of task \'" + scaledTaskName + "\' job, submitted successfully. ID = " + submittedJobId); } private List buildScalingInPATask(Task task, Job job, String scaledTaskName) { @@ -1240,14 +1243,14 @@ public class PAGateway { if (scaledTaskName.equals(task.getName())) { // When the scaled task is the task to be built - LOGGER.info("Building task " + task.getName() + " as it is scaled out"); + log.info("Building task " + task.getName() + " as it is scaled out"); scriptTasks.addAll(buildScaledPATask(task, job)); } else if (task.getParentTasks().contains(scaledTaskName)) { // When the scaled task is a parent of the task to be built - LOGGER.info("Building task " + task.getName() + " as a child of task " + scaledTaskName); + log.info("Building task " + task.getName() + " as a child of task " + scaledTaskName); scriptTasks.addAll(createChildScaledTask(task, job)); } else { - LOGGER.debug("Task " + task.getName() + " is not impacted by the scaling of task " + scaledTaskName); + log.debug("Task " + task.getName() + " is not impacted by the scaling of task " + scaledTaskName); } return scriptTasks; @@ -1263,7 +1266,7 @@ public class PAGateway { List scriptTasks = new LinkedList<>(); 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."); + log.warn("The task " + task.getName() + " does not have a deployment. It will be scheduled on any free node."); scriptTasks.addAll(createAppTasks(task, "", "", job)); task.setDeploymentFirstSubmittedTaskName(scriptTasks.get(0).getName()); task.setDeploymentLastSubmittedTaskName(scriptTasks.get(scriptTasks.size()-1).getName()); @@ -1281,11 +1284,11 @@ public class PAGateway { emsScriptTask.addDependence(scriptTasks.get(scriptTasks.size()-1)); scriptTasks.add(emsScriptTask); }); - LOGGER.info("Token added: " + token); + log.info("Token added: " + token); deployment.setIsDeployed(true); deployment.setNodeAccessToken(token); - LOGGER.info("+++ Deployment number: " + deployment.getNumber()); + log.info("+++ Deployment number: " + deployment.getNumber()); // Creating application deployment tasks @@ -1335,7 +1338,7 @@ public class PAGateway { if (task.getInstallation().getOperatingSystemType().getOperatingSystemFamily().toLowerCase(Locale.ROOT).equals("ubuntu") && task.getInstallation().getOperatingSystemType().getOperatingSystemVersion() < 2000) { - LOGGER.info("Adding apt lock handler script since task: " + task.getName() + + log.info("Adding apt lock handler script since task: " + task.getName() + " is meant to be executed in: " + task.getInstallation().getOperatingSystemType().getOperatingSystemFamily() + " version: " + task.getInstallation().getOperatingSystemType().getOperatingSystemVersion()); @@ -1376,11 +1379,11 @@ public class PAGateway { public long submitJob(String jobId) { Job jobToSubmit = EntityManagerHelper.find(Job.class, jobId); EntityManagerHelper.refresh(jobToSubmit); - LOGGER.info("Job found to submit: " + jobToSubmit.toString()); + log.info("Job found to submit: " + jobToSubmit.toString()); TaskFlowJob paJob = new TaskFlowJob(); paJob.setName(jobToSubmit.getName()); - LOGGER.info("Job created: " + paJob.toString()); + log.info("Job created: " + paJob.toString()); EntityManagerHelper.begin(); @@ -1391,7 +1394,7 @@ public class PAGateway { try { paJob.addTask(scriptTask); } catch (UserException e) { - LOGGER.error("Task " + task.getName() + " could not be added due to: " + e.toString()); + log.error("Task " + task.getName() + " could not be added due to: " + e.toString()); } }); EntityManagerHelper.persist(task); @@ -1405,9 +1408,9 @@ public class PAGateway { if (!paJob.getTasks().isEmpty()) { submittedJobId = schedulerGateway.submit(paJob).longValue(); jobToSubmit.setSubmittedJobId(submittedJobId); - LOGGER.info("Job submitted successfully. ID = " + submittedJobId); + log.info("Job submitted successfully. ID = " + submittedJobId); } else { - LOGGER.warn("The job " + jobId + " is already deployed. Nothing to be submitted here."); + log.warn("The job " + jobId + " is already deployed. Nothing to be submitted here."); } EntityManagerHelper.persist(jobToSubmit); @@ -1432,11 +1435,11 @@ public class PAGateway { * @return The job state */ public JobState getJobState(String jobId) { - LOGGER.info("Getting job " + jobId + " state "); + log.info("Getting job " + jobId + " state "); Job submittedJob = EntityManagerHelper.find(Job.class, jobId); - LOGGER.info("Job skeleton " + jobId + " mapped to the submitted ProActive job: " + submittedJob.getSubmittedJobId()); + log.info("Job skeleton " + jobId + " mapped to the submitted ProActive job: " + submittedJob.getSubmittedJobId()); JobState jobState = schedulerGateway.getJobState(String.valueOf(submittedJob.getSubmittedJobId())); - LOGGER.info("Returned state: " + jobState.getStatus().toString() + " for job: " + jobId); + log.info("Returned state: " + jobState.getStatus().toString() + " for job: " + jobId); return jobState; } @@ -1449,7 +1452,7 @@ public class PAGateway { public JobResult waitForJob(String jobId, long timeout) { Job submittedJob = EntityManagerHelper.find(Job.class, jobId); JobResult jobResult = schedulerGateway.waitForJob(String.valueOf(submittedJob.getSubmittedJobId()), timeout); - LOGGER.info("Results of job: " + jobId + " fetched successfully: " + jobResult.toString()); + log.info("Results of job: " + jobId + " fetched successfully: " + jobResult.toString()); return jobResult; } @@ -1462,9 +1465,9 @@ public class PAGateway { Job submittedJob = EntityManagerHelper.find(Job.class, jobId); boolean result = schedulerGateway.killJob(String.valueOf(submittedJob.getSubmittedJobId())); if (result) { - LOGGER.info("The job : " + jobId + " could be killed successfully."); + log.info("The job : " + jobId + " could be killed successfully."); } else { - LOGGER.error("The job : " + jobId + " could not be killed."); + log.error("The job : " + jobId + " could not be killed."); } return result; } @@ -1486,7 +1489,7 @@ public class PAGateway { submittedTaskName, timeout)); }); - LOGGER.info("Results of task: " + taskName + " fetched successfully: " + taskResultsMap.toString()); + log.info("Results of task: " + taskName + " fetched successfully: " + taskResultsMap.toString()); return taskResultsMap; } @@ -1505,7 +1508,7 @@ public class PAGateway { String.valueOf(submittedJob.getSubmittedJobId()), submittedTaskName)); }); - LOGGER.info("Results of task: " + taskName + " fetched successfully: " + taskResultsMap.toString()); + log.info("Results of task: " + taskName + " fetched successfully: " + taskResultsMap.toString()); return taskResultsMap; } }