You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2018/05/07 16:38:48 UTC
[airavata] branch staging updated: Fetching the original task id
which submitted the job when cancelling
This is an automated email from the ASF dual-hosted git repository.
dimuthuupe pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/staging by this push:
new 15c3987 Fetching the original task id which submitted the job when cancelling
15c3987 is described below
commit 15c39876ef72851beab7dcfa28eb79a441c897f2
Author: dimuthu <di...@gmail.com>
AuthorDate: Mon May 7 12:38:38 2018 -0400
Fetching the original task id which submitted the job when cancelling
---
.../main/java/org/apache/airavata/helix/impl/task/AiravataTask.java | 6 +++++-
.../airavata/helix/impl/task/cancel/RemoteJobCancellationTask.java | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/AiravataTask.java b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/AiravataTask.java
index 0cc10f9..fa423bc 100644
--- a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/AiravataTask.java
+++ b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/AiravataTask.java
@@ -54,6 +54,7 @@ import org.slf4j.MDC;
import java.io.StringWriter;
import java.util.Collections;
import java.util.List;
+import java.util.Optional;
import java.util.UUID;
public abstract class AiravataTask extends AbstractTask {
@@ -183,10 +184,13 @@ public abstract class AiravataTask extends AbstractTask {
}
- public void saveAndPublishJobStatus(String jobId, String taskId, String processId, String experimentId, String gateway,
+ public void saveAndPublishJobStatus(String jobId, String processId, String experimentId, String gateway,
JobState jobState) throws Exception {
try {
+ String taskId = Optional.ofNullable(MonitoringUtil.getTaskIdByJobId(getCuratorClient(), jobId))
+ .orElseThrow(() -> new Exception("Can not find the task for job id " + jobId));
+
JobStatus jobStatus = new JobStatus();
jobStatus.setReason(jobState.name());
jobStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
diff --git a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/cancel/RemoteJobCancellationTask.java b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/cancel/RemoteJobCancellationTask.java
index 117af81..5ff3a76 100644
--- a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/cancel/RemoteJobCancellationTask.java
+++ b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/cancel/RemoteJobCancellationTask.java
@@ -118,7 +118,7 @@ public class RemoteJobCancellationTask extends AiravataTask {
// TODO this is temporary fix. Remove this line when the schedulers are configured to notify when an job is externally cancelled
// forcefully make the job state as cancelled as some schedulers do not notify when the job is cancelled.
- saveAndPublishJobStatus(jobId, getTaskId(), getProcessId(), getExperimentId(), getGatewayId(), JobState.CANCELED);
+ saveAndPublishJobStatus(jobId, getProcessId(), getExperimentId(), getGatewayId(), JobState.CANCELED);
}
logger.info("Successfully completed job cancellation task");
--
To stop receiving notification emails like this one, please contact
dimuthuupe@apache.org.