HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
transport.ConnectionLight.ConnectionLight Class Reference
Inheritance diagram for transport.ConnectionLight.ConnectionLight:
Collaboration diagram for transport.ConnectionLight.ConnectionLight:

Public Member Functions

def __init__ (self, zmq_socket, socket_type, addr="", connected=True)
 
def send (self, event_obj)
 
def recv (self)
 
def poll (self, timeout=POLL_DEFAULT_TIMEOUT, flags=zmq.POLLIN)
 
def close (self)
 
def connect (self)
 

Public Attributes

 zmq_socket
 
 socket_type
 
 connected
 
 addr
 

Static Public Attributes

int POLL_DEFAULT_TIMEOUT = 5000
 

Detailed Description

Definition at line 26 of file ConnectionLight.py.

Constructor & Destructor Documentation

◆ __init__()

def transport.ConnectionLight.ConnectionLight.__init__ (   self,
  zmq_socket,
  socket_type,
  addr = "",
  connected = True 
)
Constructor

Definition at line 30 of file ConnectionLight.py.

30  def __init__(self, zmq_socket, socket_type, addr="", connected=True):
31  '''
32  Constructor
33  '''
34  self.zmq_socket = zmq_socket
35  self.socket_type = socket_type
36  self.connected = connected
37  self.addr = addr
38 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ close()

def transport.ConnectionLight.ConnectionLight.close (   self)

Definition at line 94 of file ConnectionLight.py.

94  def close(self):
95  self.connect()
96  self.zmq_socket.close()
97  self.connected = False
98 
99 
Here is the call graph for this function:

◆ connect()

def transport.ConnectionLight.ConnectionLight.connect (   self)

Definition at line 103 of file ConnectionLight.py.

103  def connect(self):
104  if self.connected is False:
105  self.zmq_socket.connect(self.addr)
106  self.connected = True
107 
Here is the caller graph for this function:

◆ poll()

def transport.ConnectionLight.ConnectionLight.poll (   self,
  timeout = POLL_DEFAULT_TIMEOUT,
  flags = zmq.POLLIN 
)

Definition at line 86 of file ConnectionLight.py.

86  def poll(self, timeout=POLL_DEFAULT_TIMEOUT, flags=zmq.POLLIN): # pylint: disable-msg=E1101
87  self.connect()
88  return self.zmq_socket.poll(int(timeout), flags)
89 
90 
Here is the call graph for this function:

◆ recv()

def transport.ConnectionLight.ConnectionLight.recv (   self)

Definition at line 61 of file ConnectionLight.py.

61  def recv(self):
62  try:
63  self.connect()
64  if self.socket_type == consts.CLIENT_CONNECT:
65  pyObj = self.zmq_socket.recv_pyobj()
66  logger.debug("pyObj: %s", varDump(pyObj))
67  return pyObj
68  else:
69  identity, pickle_event = self.zmq_socket.recv_multipart()
70  event = pickle.loads(pickle_event)
71  event.connect_identity = identity
72  logger.debug("event: %s", varDump(event))
73  return event
74  except zmq.ZMQError, err: # pylint: disable-msg=E1101
75  raise TransportInternalErr(err)
76  except Exception, err:
77  logger.error("Error `%s`", str(err))
78 
79 
def varDump(obj, stringify=True, strTypeMaxLen=256, strTypeCutSuffix='...', stringifyType=1, ignoreErrors=False, objectsHash=None, depth=0, indent=2, ensure_ascii=False, maxDepth=10)
Definition: Utils.py:410
Here is the call graph for this function:

◆ send()

def transport.ConnectionLight.ConnectionLight.send (   self,
  event_obj 
)

Definition at line 43 of file ConnectionLight.py.

43  def send(self, event_obj):
44  try:
45  logger.debug("event_obj: %s", varDump(event_obj))
46  self.connect()
47  if self.socket_type == consts.CLIENT_CONNECT:
48  self.zmq_socket.send_pyobj(event_obj)
49  else:
50  pickle_event = pickle.dumps(event_obj)
51  self.zmq_socket.send_multipart([event_obj.connect_identity, pickle_event])
52  except zmq.ZMQError as err: # pylint: disable-msg=E1101
53  raise TransportInternalErr(err.message)
54  except Exception, err:
55  logger.error("Error `%s`", str(err))
56 
57 
def varDump(obj, stringify=True, strTypeMaxLen=256, strTypeCutSuffix='...', stringifyType=1, ignoreErrors=False, objectsHash=None, depth=0, indent=2, ensure_ascii=False, maxDepth=10)
Definition: Utils.py:410
Here is the call graph for this function:

Member Data Documentation

◆ addr

transport.ConnectionLight.ConnectionLight.addr

Definition at line 37 of file ConnectionLight.py.

◆ connected

transport.ConnectionLight.ConnectionLight.connected

Definition at line 36 of file ConnectionLight.py.

◆ POLL_DEFAULT_TIMEOUT

int transport.ConnectionLight.ConnectionLight.POLL_DEFAULT_TIMEOUT = 5000
static

Definition at line 28 of file ConnectionLight.py.

◆ socket_type

transport.ConnectionLight.ConnectionLight.socket_type

Definition at line 35 of file ConnectionLight.py.

◆ zmq_socket

transport.ConnectionLight.ConnectionLight.zmq_socket

Definition at line 34 of file ConnectionLight.py.


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