You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by we...@apache.org on 2014/11/25 19:48:26 UTC
incubator-reef git commit: [REEF-33] Allow Tasks to initiate an
Evaluator Heartbeat
Repository: incubator-reef
Updated Branches:
refs/heads/master 1d2ab4817 -> fa353fdab
[REEF-33] Allow Tasks to initiate an Evaluator Heartbeat
This adds the class HeartBeatTriggerManager which can be used by a Task to
initiate an Evaluator Heartbeat. It is used by injecting it into the Task.
JIRA:
[REEF-33] https://issues.apache.org/jira/browse/REEF-33
Pull Request:
Closes #24
Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/fa353fda
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/fa353fda
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/fa353fda
Branch: refs/heads/master
Commit: fa353fdabc8912695ce883380fa962baea2a20fb
Parents: 1d2ab48
Author: John Yang <jo...@gmail.com>
Authored: Sat Nov 22 12:39:45 2014 +0900
Committer: Markus Weimer <we...@apache.org>
Committed: Tue Nov 25 10:44:31 2014 -0800
----------------------------------------------------------------------
.../reef/task/HeartBeatTriggerManager.java | 53 ++++++++++++++++++++
1 file changed, 53 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/fa353fda/reef-common/src/main/java/org/apache/reef/task/HeartBeatTriggerManager.java
----------------------------------------------------------------------
diff --git a/reef-common/src/main/java/org/apache/reef/task/HeartBeatTriggerManager.java b/reef-common/src/main/java/org/apache/reef/task/HeartBeatTriggerManager.java
new file mode 100644
index 0000000..7137420
--- /dev/null
+++ b/reef-common/src/main/java/org/apache/reef/task/HeartBeatTriggerManager.java
@@ -0,0 +1,53 @@
+/**
+ * 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.reef.task;
+
+import org.apache.reef.annotations.Unstable;
+import org.apache.reef.annotations.audience.Public;
+import org.apache.reef.annotations.audience.TaskSide;
+import org.apache.reef.runtime.common.evaluator.HeartBeatManager;
+
+import javax.inject.Inject;
+
+/**
+ * Helper class for immediately sending heartbeat messages.
+ * This can be used together with TaskMessageSource to push urgent messages to the Driver.
+ * <p/>
+ * CAUTION: Do not overuse as the Driver can be saturated with heartbeats.
+ *
+ * @see https://issues.apache.org/jira/browse/REEF-33 for the ongoing discussion of alternatives to this design.
+ */
+@TaskSide
+@Public
+@Unstable
+public class HeartBeatTriggerManager {
+ private final HeartBeatManager heartBeatManager;
+
+ @Inject
+ HeartBeatTriggerManager(final HeartBeatManager heartBeatManager) {
+ this.heartBeatManager = heartBeatManager;
+ }
+
+ /**
+ * Immediately send a heartbeat message to the Driver.
+ */
+ public void triggerHeartBeat() {
+ this.heartBeatManager.sendHeartbeat();
+ }
+}
\ No newline at end of file