Public Member Functions | Public Attributes | Properties | Private Member Functions | Private Attributes | List of all members
bondpy.bondpy.Bond Class Reference

Forms a bond to monitor another process. More...

Inheritance diagram for bondpy.bondpy.Bond:
Inheritance graph
[legend]

Public Member Functions

def __del__ (self)
 
def __init__ (self, topic, id, on_broken=None, on_formed=None)
 Constructs a bond, but does not connect. More...
 
def __repr__ (self)
 
def break_bond (self)
 Breaks the bond, notifying the other process. More...
 
def Connected (self)
 INTERNAL. More...
 
def Death (self)
 INTERNAL. More...
 
def get_connect_timeout (self)
 
def get_disconnect_timeout (self)
 
def get_heartbeat_period (self)
 
def get_heartbeat_timeout (self)
 
def Heartbeat (self)
 INTERNAL. More...
 
def is_broken (self)
 Indicates if the bond is broken. More...
 
def set_broken_callback (self, on_broken)
 Sets the broken callback. More...
 
def set_connect_timeout (self, dur)
 
def set_disconnect_timeout (self, dur)
 
def set_formed_callback (self, on_formed)
 Sets the formed callback. More...
 
def set_heartbeat_period (self, per)
 
def set_heartbeat_timeout (self, dur)
 
def shutdown (self)
 
def SisterDied (self)
 INTERNAL. More...
 
def start (self)
 Starts the bond and connects to the sister process. More...
 
def StartDying (self)
 INTERNAL. More...
 
def wait_until_broken (self, timeout=None)
 Blocks until the bond is broken for at most 'duration'. More...
 
def wait_until_formed (self, timeout=None)
 Blocks until the bond is formed for at most 'duration'. More...
 

Public Attributes

 condition
 
 connect_timer
 
 deadline
 
 disconnect_timer
 
 heartbeat_timer
 
 id
 
 instance_id
 
 is_shutdown
 
 lock
 
 on_broken
 
 on_formed
 
 pending_callbacks
 
 pub
 
 sister_died_first
 
 sister_instance_id
 
 sm
 
 sub
 
 thread
 
 topic
 

Properties

 connect_timeout = property(get_connect_timeout, set_connect_timeout)
 
 disconnect_timeout = property(get_disconnect_timeout, set_disconnect_timeout)
 
 heartbeat_period = property(get_heartbeat_period, set_heartbeat_period)
 
 heartbeat_timeout = property(get_heartbeat_timeout, set_heartbeat_timeout)
 

Private Member Functions

def _flush_pending_callbacks (self)
 
def _on_bond_status (self, msg)
 
def _on_connect_timeout (self)
 
def _on_disconnect_timeout (self)
 
def _on_heartbeat_timeout (self)
 
def _publish (self, active)
 
def _publishing_thread (self)
 

Private Attributes

 __connect_timeout
 
 __disconnect_timeout
 
 __heartbeat_period
 
 __heartbeat_timeout
 
 __started
 

Detailed Description

Forms a bond to monitor another process.

The Bond class implements a bond, allowing you to monitor another process and be notified when it dies. In turn, it will be notified when you die.

Definition at line 86 of file bondpy.py.

Constructor & Destructor Documentation

def bondpy.bondpy.Bond.__init__ (   self,
  topic,
  id,
  on_broken = None,
  on_formed = None 
)

Constructs a bond, but does not connect.

Parameters
topicThe topic used to exchange the bond status messages.
idThe ID of the bond, which should match the ID used on the sister's end
on_brokencallback that will be called when the bond is broken.
on_formedcallback that will be called when the bond is formed.

Definition at line 94 of file bondpy.py.

def bondpy.bondpy.Bond.__del__ (   self)

Definition at line 198 of file bondpy.py.

Member Function Documentation

def bondpy.bondpy.Bond.__repr__ (   self)

Definition at line 364 of file bondpy.py.

def bondpy.bondpy.Bond._flush_pending_callbacks (   self)
private

Definition at line 261 of file bondpy.py.

def bondpy.bondpy.Bond._on_bond_status (   self,
  msg 
)
private

Definition at line 215 of file bondpy.py.

def bondpy.bondpy.Bond._on_connect_timeout (   self)
private

Definition at line 174 of file bondpy.py.

def bondpy.bondpy.Bond._on_disconnect_timeout (   self)
private

Definition at line 193 of file bondpy.py.

def bondpy.bondpy.Bond._on_heartbeat_timeout (   self)
private

Definition at line 179 of file bondpy.py.

def bondpy.bondpy.Bond._publish (   self,
  active 
)
private

Definition at line 239 of file bondpy.py.

def bondpy.bondpy.Bond._publishing_thread (   self)
private

Definition at line 249 of file bondpy.py.

def bondpy.bondpy.Bond.break_bond (   self)

Breaks the bond, notifying the other process.

Definition at line 358 of file bondpy.py.

def bondpy.bondpy.Bond.Connected (   self)

INTERNAL.

Definition at line 270 of file bondpy.py.

def bondpy.bondpy.Bond.Death (   self)

INTERNAL.

Definition at line 285 of file bondpy.py.

def bondpy.bondpy.Bond.get_connect_timeout (   self)

Definition at line 128 of file bondpy.py.

def bondpy.bondpy.Bond.get_disconnect_timeout (   self)

Definition at line 146 of file bondpy.py.

def bondpy.bondpy.Bond.get_heartbeat_period (   self)

Definition at line 155 of file bondpy.py.

def bondpy.bondpy.Bond.get_heartbeat_timeout (   self)

Definition at line 137 of file bondpy.py.

def bondpy.bondpy.Bond.Heartbeat (   self)

INTERNAL.

Definition at line 277 of file bondpy.py.

def bondpy.bondpy.Bond.is_broken (   self)

Indicates if the bond is broken.

Returns
true iff the bond has been broken.

Definition at line 353 of file bondpy.py.

def bondpy.bondpy.Bond.set_broken_callback (   self,
  on_broken 
)

Sets the broken callback.

Definition at line 303 of file bondpy.py.

def bondpy.bondpy.Bond.set_connect_timeout (   self,
  dur 
)

Definition at line 131 of file bondpy.py.

def bondpy.bondpy.Bond.set_disconnect_timeout (   self,
  dur 
)

Definition at line 149 of file bondpy.py.

def bondpy.bondpy.Bond.set_formed_callback (   self,
  on_formed 
)

Sets the formed callback.

Definition at line 298 of file bondpy.py.

def bondpy.bondpy.Bond.set_heartbeat_period (   self,
  per 
)

Definition at line 158 of file bondpy.py.

def bondpy.bondpy.Bond.set_heartbeat_timeout (   self,
  dur 
)

Definition at line 140 of file bondpy.py.

def bondpy.bondpy.Bond.shutdown (   self)

Definition at line 201 of file bondpy.py.

def bondpy.bondpy.Bond.SisterDied (   self)

INTERNAL.

Definition at line 281 of file bondpy.py.

def bondpy.bondpy.Bond.start (   self)

Starts the bond and connects to the sister process.

Definition at line 164 of file bondpy.py.

def bondpy.bondpy.Bond.StartDying (   self)

INTERNAL.

Definition at line 293 of file bondpy.py.

def bondpy.bondpy.Bond.wait_until_broken (   self,
  timeout = None 
)

Blocks until the bond is broken for at most 'duration'.

Parameters
timeoutMaximum duration to wait. If None then this call will not timeout.
Returns
true iff the bond has been broken, even if it has never been formed.

Definition at line 333 of file bondpy.py.

def bondpy.bondpy.Bond.wait_until_formed (   self,
  timeout = None 
)

Blocks until the bond is formed for at most 'duration'.

Parameters
timeoutMaximum duration to wait. If None then this call will not timeout.
Returns
true iff the bond has been formed.

Definition at line 311 of file bondpy.py.

Member Data Documentation

bondpy.bondpy.Bond.__connect_timeout
private

Definition at line 133 of file bondpy.py.

bondpy.bondpy.Bond.__disconnect_timeout
private

Definition at line 151 of file bondpy.py.

bondpy.bondpy.Bond.__heartbeat_period
private

Definition at line 160 of file bondpy.py.

bondpy.bondpy.Bond.__heartbeat_timeout
private

Definition at line 142 of file bondpy.py.

bondpy.bondpy.Bond.__started
private

Definition at line 95 of file bondpy.py.

bondpy.bondpy.Bond.condition

Definition at line 114 of file bondpy.py.

bondpy.bondpy.Bond.connect_timer

Definition at line 134 of file bondpy.py.

bondpy.bondpy.Bond.deadline

Definition at line 105 of file bondpy.py.

bondpy.bondpy.Bond.disconnect_timer

Definition at line 152 of file bondpy.py.

bondpy.bondpy.Bond.heartbeat_timer

Definition at line 143 of file bondpy.py.

bondpy.bondpy.Bond.id

Definition at line 97 of file bondpy.py.

bondpy.bondpy.Bond.instance_id

Definition at line 98 of file bondpy.py.

bondpy.bondpy.Bond.is_shutdown

Definition at line 102 of file bondpy.py.

bondpy.bondpy.Bond.lock

Definition at line 113 of file bondpy.py.

bondpy.bondpy.Bond.on_broken

Definition at line 100 of file bondpy.py.

bondpy.bondpy.Bond.on_formed

Definition at line 101 of file bondpy.py.

bondpy.bondpy.Bond.pending_callbacks

Definition at line 109 of file bondpy.py.

bondpy.bondpy.Bond.pub

Definition at line 126 of file bondpy.py.

bondpy.bondpy.Bond.sister_died_first

Definition at line 103 of file bondpy.py.

bondpy.bondpy.Bond.sister_instance_id

Definition at line 99 of file bondpy.py.

bondpy.bondpy.Bond.sm

Definition at line 111 of file bondpy.py.

bondpy.bondpy.Bond.sub

Definition at line 122 of file bondpy.py.

bondpy.bondpy.Bond.thread

Definition at line 169 of file bondpy.py.

bondpy.bondpy.Bond.topic

Definition at line 96 of file bondpy.py.

Property Documentation

bondpy.bondpy.Bond.connect_timeout = property(get_connect_timeout, set_connect_timeout)
static

Definition at line 135 of file bondpy.py.

bondpy.bondpy.Bond.disconnect_timeout = property(get_disconnect_timeout, set_disconnect_timeout)
static

Definition at line 153 of file bondpy.py.

bondpy.bondpy.Bond.heartbeat_period = property(get_heartbeat_period, set_heartbeat_period)
static

Definition at line 161 of file bondpy.py.

bondpy.bondpy.Bond.heartbeat_timeout = property(get_heartbeat_timeout, set_heartbeat_timeout)
static

Definition at line 144 of file bondpy.py.


The documentation for this class was generated from the following file:


bondpy
Author(s): Stuart Glaser
autogenerated on Wed Sep 2 2020 03:40:45