Skip to content

Commit

Permalink
Merge pull request #94 from 6si/enable-heartbeats
Browse files Browse the repository at this point in the history
Allow the scheduler to receive heart beats
  • Loading branch information
windreamer authored Apr 2, 2018
2 parents 20914f7 + 22b77b1 commit c6a69a6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pymesos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .operator_v1 import MesosOperatorMasterDriver, MesosOperatorAgentDriver
from .utils import encode_data, decode_data

__VERSION__ = '0.3.1'
__VERSION__ = '0.3.2'

__all__ = (
'Scheduler',
Expand Down
5 changes: 5 additions & 0 deletions pymesos/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def disconnected(self, driver):
the master fails and another is taking over.
"""

def processHeartBeat(self):
"""
Invoked when the scheduler gets a heartbeat
"""

def resourceOffers(self, driver, offers):
"""
Invoked when resources have been offered to this framework. A single
Expand Down
5 changes: 5 additions & 0 deletions pymesos/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,15 @@ def on_error(self, event):
message = event['message']
self.sched.error(self, message)

def on_heartbeat(self):
self.sched.processHeartBeat()

def on_event(self, event):
if 'type' in event:
_type = event['type'].lower()

if _type == 'heartbeat':
self.on_heartbeat()
return

if _type not in event:
Expand Down

0 comments on commit c6a69a6

Please sign in to comment.