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
admin.NodeManagerRequest Namespace Reference

Classes

class  NodeManagerRequest
 NodeManagerRequest class contents all data needed for admin level's request sending. More...
 

Functions

def raiseAdminExceptions (self, exceptionString)
 raiseAdminExceptions method generates exceptions based on analyze of exceptionString param's data More...
 
def makeRequest (self, node, message, commandTimeout=None)
 makeRequest main class method, it gets node and message params, interact with transport layer, makes NodeManagerResponse object, based on transport layer's return data, returns it. More...
 

Detailed Description

Created on Feb 17, 2014

@author: scorp
@link: http://hierarchical-cluster-engine.com/
@copyright: Copyright © 2013-2014 IOIX Ukraine
@license: http://hierarchical-cluster-engine.com/license/
@since: 0.1

Function Documentation

◆ makeRequest()

def admin.NodeManagerRequest.makeRequest (   self,
  node,
  message,
  commandTimeout = None 
)

makeRequest main class method, it gets node and message params, interact with transport layer, makes NodeManagerResponse object, based on transport layer's return data, returns it.

Definition at line 56 of file NodeManagerRequest.py.

56  def makeRequest(self, node, message, commandTimeout=None):
57  exceptionString = None
58  respond = None
59  adminConnection = None
60  connectParams = ConnectionParams(node.getHost(), node.getPort())
61  try:
62  adminConnection = self.connectionBuilder.build(transport.Consts.ADMIN_CONNECT_TYPE, connectParams)
63  except KeyError as exp:
64  exceptionString = CONSTANTS.STRING_EXCEPTION_WRONG_CONNECTION_KEY
65 
66  if adminConnection != None:
67  request = Request(message[CONSTANTS.STRING_MSGID_NAME])
68  request.add_data(message[CONSTANTS.STRING_BODY_NAME])
69  adminConnection.send(request)
70 
71  localTimeout = -1
72  if commandTimeout == None:
73  elapsedTime = node.getElapsedTime()
74  if elapsedTime >= node.getTimeout():
75  exceptionString = CONSTANTS.STRING_EXCEPTION_ADMIN_TIMEOUT
76  else:
77  localTimeout = node.getTimeout() - elapsedTime
78  else:
79  localTimeout = commandTimeout
80 
81  if localTimeout >= 0:
82  try:
83  respond = adminConnection.recv(localTimeout)
84  except ConnectionTimeout as exp:
85  exceptionString = exp.message
86  adminConnection.close()
87  self.raiseAdminExceptions(exceptionString)
88  return self.createNodeManagerResponse(respond, message)
89 
def makeRequest(self, node, message, commandTimeout=None)
makeRequest main class method, it gets node and message params, interact with transport layer...
Here is the caller graph for this function:

◆ raiseAdminExceptions()

def admin.NodeManagerRequest.raiseAdminExceptions (   self,
  exceptionString 
)

raiseAdminExceptions method generates exceptions based on analyze of exceptionString param's data

Definition at line 46 of file NodeManagerRequest.py.

46  def raiseAdminExceptions(self, exceptionString):
47  if exceptionString != None:
48  if exceptionString == CONSTANTS.STRING_EXCEPTION_WRONG_CONNECTION_KEY:
49  raise AdminExceptions.AdminWrongConnectionKey(exceptionString)
50  else:
51  raise AdminExceptions.AdminTimeoutException(exceptionString)
52 
53 
def raiseAdminExceptions(self, exceptionString)
raiseAdminExceptions method generates exceptions based on analyze of exceptionString param's data ...
Here is the caller graph for this function: