falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject falcon git commit: FALCON-1651 Falcon doesn't start. Contributed by Ajay Yadava.
Date Wed, 09 Dec 2015 12:04:43 GMT
Repository: falcon
Updated Branches:
  refs/heads/master bbfbe087c -> 0df8e7f0a


FALCON-1651 Falcon doesn't start. Contributed by Ajay Yadava.


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

Branch: refs/heads/master
Commit: 0df8e7f0a59664d246bc7834fdc60100e524d5f5
Parents: bbfbe08
Author: Ajay Yadava <ajaynsit@gmail.com>
Authored: Wed Dec 9 17:23:07 2015 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Wed Dec 9 17:23:07 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../falcon/handler/SLAMonitoringHandler.java    | 84 ++++++++++++++++++++
 2 files changed, 86 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/0df8e7f0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0b1e5bf..f0aca7f 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -60,6 +60,8 @@ Trunk (Unreleased)
   OPTIMIZATIONS
 
   BUG FIXES
+    FALCON-1651 Falcon doesn't start (Ajay Yadava)
+
     FALCON-1598 Flaky test : EntityManagerJerseyIT.testDuplicateDeleteCommands (Narayan Periwal
via Pallavi Rao)
 
     FALCON-1568 Process Instances are not getting scheduled in Falcon Native Scheduler (Pallavi
Rao)

http://git-wip-us.apache.org/repos/asf/falcon/blob/0df8e7f0/prism/src/main/java/org/apache/falcon/handler/SLAMonitoringHandler.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/handler/SLAMonitoringHandler.java b/prism/src/main/java/org/apache/falcon/handler/SLAMonitoringHandler.java
new file mode 100644
index 0000000..bb3b8e0
--- /dev/null
+++ b/prism/src/main/java/org/apache/falcon/handler/SLAMonitoringHandler.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.falcon.handler;
+
+
+import org.apache.falcon.FalconException;
+import org.apache.falcon.entity.EntityUtil;
+import org.apache.falcon.entity.FeedHelper;
+import org.apache.falcon.entity.Storage;
+import org.apache.falcon.entity.v0.EntityType;
+import org.apache.falcon.entity.v0.feed.Feed;
+import org.apache.falcon.entity.v0.feed.LocationType;
+import org.apache.falcon.service.FeedSLAMonitoringService;
+import org.apache.falcon.workflow.WorkflowExecutionContext;
+import org.apache.falcon.workflow.WorkflowExecutionListener;
+import org.apache.hadoop.fs.Path;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+
+/**
+ * Class for handling workflow notifications to monitor SLA.
+ */
+public class SLAMonitoringHandler implements WorkflowExecutionListener {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SLAMonitoringHandler.class);
+
+    @Override
+    public void onSuccess(WorkflowExecutionContext context) throws FalconException {
+        if (context.hasWorkflowSucceeded()) {
+            updateSLAMonitoring(context.getClusterName(), context.getOutputFeedNamesList(),
+                    context.getOutputFeedInstancePathsList());
+        }
+    }
+
+    private void updateSLAMonitoring(String clusterName, String[] outputFeedNamesList,
+                                     String[] outputFeedInstancePathsList) throws FalconException
{
+        Storage storage;
+        for (int index=0; index<outputFeedNamesList.length; index++) {
+            Feed feed = EntityUtil.getEntity(EntityType.FEED, outputFeedNamesList[index]);
+            storage = FeedHelper.createStorage(clusterName, feed);
+            String templatePath = new Path(storage.getUriTemplate(LocationType.DATA)).toUri().getPath();
+            Date date = FeedHelper.getDate(templatePath, new Path(outputFeedInstancePathsList[index]),
+                    EntityUtil.getTimeZone(feed));
+            FeedSLAMonitoringService.get().makeFeedInstanceAvailable(outputFeedNamesList[index],
clusterName, date);
+        }
+    }
+
+    @Override
+    public void onFailure(WorkflowExecutionContext context) throws FalconException {
+        // do nothing since nothing to update in SLA Monitoring
+    }
+
+    @Override
+    public void onStart(WorkflowExecutionContext context) throws FalconException {
+        // do nothing since nothing to update in SLA Monitoring
+    }
+
+    @Override
+    public void onSuspend(WorkflowExecutionContext context) throws FalconException {
+        // do nothing since nothing to update in SLA Monitoring
+    }
+
+    @Override
+    public void onWait(WorkflowExecutionContext context) throws FalconException {
+        // do nothing since nothing to update in SLA Monitoring
+    }
+}


Mime
View raw message