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/11/20 15:34:44 UTC
[airavata] branch staging updated: Making workflow operator a
global variable
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 8ec3f54 Making workflow operator a global variable
8ec3f54 is described below
commit 8ec3f54b8e3a7c6a36303fe0f5449e644208d447
Author: Dimuthu Wannipurage <di...@datasprouts.com>
AuthorDate: Tue Nov 20 10:34:35 2018 -0500
Making workflow operator a global variable
---
.../apache/airavata/helix/cluster/monitoring/MainMonitor.java | 2 +-
.../helix/cluster/monitoring/agents/HelixParticipantMonitor.java | 9 +++------
.../org/apache/airavata/helix/workflow/WorkflowOperator.java | 4 ++++
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/airavata-helix/platform-monitor/src/main/java/org/apache/airavata/helix/cluster/monitoring/MainMonitor.java b/modules/airavata-helix/platform-monitor/src/main/java/org/apache/airavata/helix/cluster/monitoring/MainMonitor.java
index 96b0c47..7b02f02 100644
--- a/modules/airavata-helix/platform-monitor/src/main/java/org/apache/airavata/helix/cluster/monitoring/MainMonitor.java
+++ b/modules/airavata-helix/platform-monitor/src/main/java/org/apache/airavata/helix/cluster/monitoring/MainMonitor.java
@@ -16,7 +16,7 @@ public class MainMonitor {
private final static Logger logger = LoggerFactory.getLogger(MainMonitor.class);
- public static void main(String args[]) throws ApplicationSettingsException {
+ public static void main(String args[]) throws Exception {
logger.info("Starting platform monitor");
diff --git a/modules/airavata-helix/platform-monitor/src/main/java/org/apache/airavata/helix/cluster/monitoring/agents/HelixParticipantMonitor.java b/modules/airavata-helix/platform-monitor/src/main/java/org/apache/airavata/helix/cluster/monitoring/agents/HelixParticipantMonitor.java
index 5d85f27..1365346 100644
--- a/modules/airavata-helix/platform-monitor/src/main/java/org/apache/airavata/helix/cluster/monitoring/agents/HelixParticipantMonitor.java
+++ b/modules/airavata-helix/platform-monitor/src/main/java/org/apache/airavata/helix/cluster/monitoring/agents/HelixParticipantMonitor.java
@@ -25,8 +25,10 @@ public class HelixParticipantMonitor implements PlatformMonitor {
private String helixClusterName = ServerSettings.getSetting("helix.cluster.name");
private String instanceName = ServerSettings.getSetting("helix.participant.name");
private String zkConnectionString = ServerSettings.getZookeeperConnection();
+ private WorkflowOperator operator;
- public HelixParticipantMonitor() throws ApplicationSettingsException {
+ public HelixParticipantMonitor() throws Exception {
+ operator = new WorkflowOperator(helixClusterName, "mock-wf-operator", zkConnectionString);
}
public void monitor(ErrorNotifier notifier) {
@@ -81,7 +83,6 @@ public class HelixParticipantMonitor implements PlatformMonitor {
private PlatformMonitorError checkMockWorkflow() {
MockTask mockTask = new MockTask();
mockTask.setTaskId("Mock-" + UUID.randomUUID().toString());
- WorkflowOperator operator = null;
try {
operator = new WorkflowOperator(helixClusterName, "mock-wf-operator", zkConnectionString);
String workflow = operator.launchWorkflow(UUID.randomUUID().toString(), Collections.singletonList(mockTask), true, false);
@@ -102,10 +103,6 @@ public class HelixParticipantMonitor implements PlatformMonitor {
monitorError.setCategory("Participant");
monitorError.setErrorCode("P004");
return monitorError;
- } finally {
- if (operator != null) {
- operator.disconnect();
- }
}
return null;
}
diff --git a/modules/airavata-helix/workflow-impl/src/main/java/org/apache/airavata/helix/workflow/WorkflowOperator.java b/modules/airavata-helix/workflow-impl/src/main/java/org/apache/airavata/helix/workflow/WorkflowOperator.java
index 5a01c57..edca657 100644
--- a/modules/airavata-helix/workflow-impl/src/main/java/org/apache/airavata/helix/workflow/WorkflowOperator.java
+++ b/modules/airavata-helix/workflow-impl/src/main/java/org/apache/airavata/helix/workflow/WorkflowOperator.java
@@ -136,4 +136,8 @@ public class WorkflowOperator {
return taskDriver.pollForWorkflowState(workflowName, timeout, TaskState.COMPLETED,
TaskState.FAILED, TaskState.STOPPED, TaskState.ABORTED);
}
+
+ public TaskState getWorkflowState(String workflow) {
+ return taskDriver.getWorkflowContext(workflow).getWorkflowState();
+ }
}
\ No newline at end of file