helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject git commit: Add container information to job runner recipe
Date Thu, 01 May 2014 19:50:57 GMT
Repository: helix
Updated Branches:
  refs/heads/helix-provisioning 785bb9fbb -> c73e95eaa


Add container information to job runner recipe


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/c73e95ea
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/c73e95ea
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/c73e95ea

Branch: refs/heads/helix-provisioning
Commit: c73e95eaa07cf71996453f206dc691099f7868d6
Parents: 785bb9f
Author: Kanak Biscuitwala <kanak@apache.org>
Authored: Thu May 1 12:50:42 2014 -0700
Committer: Kanak Biscuitwala <kanak@apache.org>
Committed: Thu May 1 12:50:42 2014 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/helix/task/TaskDriver.java      | 5 +++++
 .../src/main/java/org/apache/helix/task/WorkflowConfig.java  | 4 ++++
 .../org/apache/helix/provisioning/ParticipantLauncher.java   | 1 +
 .../java/org/apache/helix/provisioning/yarn/AppLauncher.java | 8 ++++++++
 .../helix/provisioning/yarn/AppStatusReportGenerator.java    | 2 --
 .../helix/provisioning/yarn/example/JobRunnerMain.java       | 5 +++++
 6 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/c73e95ea/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java b/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
index 193b78e..c8f0d08 100644
--- a/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
+++ b/helix-core/src/main/java/org/apache/helix/task/TaskDriver.java
@@ -234,11 +234,16 @@ public class TaskDriver {
 
     System.out.println("Workflow " + resource + " consists of the following tasks: "
         + wCfg.getJobDag().getAllNodes());
+    TaskState workflowState = wCtx.getWorkflowState();
+    if (workflowState == null) {
+      workflowState = TaskState.IN_PROGRESS;
+    }
     System.out.println("Current state of workflow is " + wCtx.getWorkflowState().name());
     System.out.println("Job states are: ");
     System.out.println("-------");
     for (String job : wCfg.getJobDag().getAllNodes()) {
       System.out.println("Job " + job + " is " + wCtx.getJobState(job));
+      System.out.println("-------");
 
       // fetch task information
       JobConfig jCfg = TaskUtil.getJobCfg(_manager, job);

http://git-wip-us.apache.org/repos/asf/helix/blob/c73e95ea/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java b/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java
index 6f10955..ff4a2a9 100644
--- a/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java
+++ b/helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java
@@ -89,6 +89,10 @@ public class WorkflowConfig {
     public static Builder fromMap(Map<String, String> cfg) {
       Builder b = new Builder();
 
+      if (cfg == null) {
+        return b;
+      }
+
       if (cfg.containsKey(EXPIRY)) {
         b.setExpiry(Long.parseLong(cfg.get(EXPIRY)));
       }

http://git-wip-us.apache.org/repos/asf/helix/blob/c73e95ea/helix-provisioning/src/main/java/org/apache/helix/provisioning/ParticipantLauncher.java
----------------------------------------------------------------------
diff --git a/helix-provisioning/src/main/java/org/apache/helix/provisioning/ParticipantLauncher.java
b/helix-provisioning/src/main/java/org/apache/helix/provisioning/ParticipantLauncher.java
index 60231fb..59a9eb5 100644
--- a/helix-provisioning/src/main/java/org/apache/helix/provisioning/ParticipantLauncher.java
+++ b/helix-provisioning/src/main/java/org/apache/helix/provisioning/ParticipantLauncher.java
@@ -130,6 +130,7 @@ public class ParticipantLauncher {
 
     @Override
     public void onError(Exception e, ErrorCode code, ErrorType type) {
+      LOG.error("Shutdown message error", e);
     }
 
   }

http://git-wip-us.apache.org/repos/asf/helix/blob/c73e95ea/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppLauncher.java
----------------------------------------------------------------------
diff --git a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppLauncher.java
b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppLauncher.java
index 9a19842..76b7877 100644
--- a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppLauncher.java
+++ b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppLauncher.java
@@ -400,6 +400,14 @@ public class AppLauncher {
     return null;
   }
 
+  public ApplicationReport getApplicationReport() {
+    try {
+      return yarnClient.getApplicationReport(_appId);
+    } catch (Exception e) {
+      return null;
+    }
+  }
+
   /**
    * @return true if successfully completed, it will print status every X seconds
    */

http://git-wip-us.apache.org/repos/asf/helix/blob/c73e95ea/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppStatusReportGenerator.java
----------------------------------------------------------------------
diff --git a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppStatusReportGenerator.java
b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppStatusReportGenerator.java
index b083ac9..40c8186 100644
--- a/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppStatusReportGenerator.java
+++ b/helix-provisioning/src/main/java/org/apache/helix/provisioning/yarn/AppStatusReportGenerator.java
@@ -2,8 +2,6 @@ package org.apache.helix.provisioning.yarn;
 
 import java.util.Map;
 
-import jline.ConsoleReader;
-
 import org.apache.helix.HelixConnection;
 import org.apache.helix.api.Participant;
 import org.apache.helix.api.Resource;

http://git-wip-us.apache.org/repos/asf/helix/blob/c73e95ea/recipes/jobrunner-yarn/src/main/java/org/apache/helix/provisioning/yarn/example/JobRunnerMain.java
----------------------------------------------------------------------
diff --git a/recipes/jobrunner-yarn/src/main/java/org/apache/helix/provisioning/yarn/example/JobRunnerMain.java
b/recipes/jobrunner-yarn/src/main/java/org/apache/helix/provisioning/yarn/example/JobRunnerMain.java
index 623854f..78266cf 100644
--- a/recipes/jobrunner-yarn/src/main/java/org/apache/helix/provisioning/yarn/example/JobRunnerMain.java
+++ b/recipes/jobrunner-yarn/src/main/java/org/apache/helix/provisioning/yarn/example/JobRunnerMain.java
@@ -14,6 +14,7 @@ import org.apache.helix.HelixManager;
 import org.apache.helix.HelixRole;
 import org.apache.helix.InstanceType;
 import org.apache.helix.api.Participant;
+import org.apache.helix.api.RunningInstance;
 import org.apache.helix.api.accessor.ClusterAccessor;
 import org.apache.helix.api.config.ContainerConfig;
 import org.apache.helix.api.id.ClusterId;
@@ -115,6 +116,10 @@ public class JobRunnerMain {
             System.out.println(participant.getId() + "[" + containerConfig.getId() + "]:
"
                 + containerConfig.getState());
           }
+          if (participant.isAlive()) {
+            RunningInstance runningInstance = participant.getRunningInstance();
+            System.out.println("\tProcess: " + runningInstance.getPid());
+          }
         }
         System.out.println("----------------");
         System.out.println("TASK STATUS");


Mime
View raw message