Repository: falcon Updated Branches: refs/heads/master 136506482 -> cecc3b427
FALCON-1153 Instance kill fails intermittently. Contributed by Balu Vellanki Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/cecc3b42 Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/cecc3b42 Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/cecc3b42 Branch: refs/heads/master Commit: cecc3b427505fb88a4e1a35c9b9c1c6c512caf3a Parents: 1365064 Author: Sowmya Ramesh <[email protected]> Authored: Wed Apr 22 16:15:31 2015 -0700 Committer: Sowmya Ramesh <[email protected]> Committed: Wed Apr 22 16:15:31 2015 -0700 ---------------------------------------------------------------------- .../workflow/engine/OozieWorkflowEngine.java | 19 +++++++++++++++---- src/conf/runtime.properties | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/cecc3b42/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java ---------------------------------------------------------------------- diff --git a/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java b/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java index 2dc42b4..90772b8 100644 --- a/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java +++ b/oozie/src/main/java/org/apache/falcon/workflow/engine/OozieWorkflowEngine.java @@ -107,6 +107,9 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine { private static final String FALCON_INSTANCE_ACTION_CLUSTERS = "falcon.instance.action.clusters"; private static final String FALCON_INSTANCE_SOURCE_CLUSTERS = "falcon.instance.source.clusters"; + private static final int WORKFLOW_STATUS_RETRY_DELAY_MS = 100; // milliseconds + private static final String WORKFLOW_STATUS_RETRY_COUNT = "workflow.status.retry.count"; + private static final List<String> PARENT_WF_ACTION_NAMES = Arrays.asList( "pre-processing", "recordsize", @@ -1348,18 +1351,26 @@ public class OozieWorkflowEngine extends AbstractWorkflowEngine { private void assertStatus(String cluster, String jobId, Status... statuses) throws FalconException { - String actualStatus = getWorkflowStatus(cluster, jobId); - for (int counter = 0; counter < 3; counter++) { + String actualStatus = null; + int retryCount; + String retry = RuntimeProperties.get().getProperty(WORKFLOW_STATUS_RETRY_COUNT, "30"); + try { + retryCount = Integer.valueOf(retry); + } catch (NumberFormatException nfe) { + throw new FalconException("Invalid value provided for runtime property \"" + + WORKFLOW_STATUS_RETRY_COUNT + "\". Please provide an integer value."); + } + for (int counter = 0; counter < retryCount; counter++) { + actualStatus = getWorkflowStatus(cluster, jobId); if (!statusEquals(actualStatus, statuses)) { try { - Thread.sleep(100); + Thread.sleep(WORKFLOW_STATUS_RETRY_DELAY_MS); } catch (InterruptedException ignore) { //ignore } } else { return; } - actualStatus = getWorkflowStatus(cluster, jobId); } throw new FalconException("For Job" + jobId + ", actual statuses: " + actualStatus + ", expected statuses: " + Arrays.toString(statuses)); http://git-wip-us.apache.org/repos/asf/falcon/blob/cecc3b42/src/conf/runtime.properties ---------------------------------------------------------------------- diff --git a/src/conf/runtime.properties b/src/conf/runtime.properties index 0dc43c6..a40d369 100644 --- a/src/conf/runtime.properties +++ b/src/conf/runtime.properties @@ -29,3 +29,5 @@ prism.falcon.local.endpoint=https://localhost:15443 #falcon server should have the following properties falcon.current.colo=local webservices.default.max.results.per.page=100 +# retry count - to fetch the status from the workflow engine +workflow.status.retry.count=30 \ No newline at end of file
