2 Created on Feb 13, 2014 26 Exception.__init__(self, msg)
67 def execute(self, command, timeout=1000, ttl=30000, maxTries=100):
72 logger.debug(
"command: %s", Utils.varDump(command, strTypeMaxLen=10000))
74 drce_cover_envelop =
DRCECover(ttl, cmd_json)
76 request.add_data(json.dumps(drce_cover_envelop, cls=TaskExecuteStructEncoder))
77 request.route = command.route
78 request.task_type = command.task_type
80 uid = request.get_uid()
81 logger.debug(
"Send DRCE request msg Id:" + uid +
", route: " + str(request.route))
85 for i
in range(int(maxTries) + 1):
87 logger.debug(
"Received DRCE response msg Id:" + response.get_uid())
88 if response.get_uid() == request.get_uid()
or maxTries == 0:
89 cover_envelop_response = json.loads(response.get_body())
90 return self.
cmd_convertor.from_json(cover_envelop_response[
"data"])
92 logger.error(
"DRCE response msg Id:" + response.get_uid() + \
93 " not matched with the request msg Id:" + request.get_uid() + \
95 except (ResponseFormatErr, CommandConvertorError, KeyError, CommandExecutorErr)
as err:
96 logger.error(
"DRCE object model error: %s", str(err))
98 except Exception
as err:
99 logger.error(
"General error: %s", str(err))
def execute(self, command, timeout=1000, ttl=30000, maxTries=100)
def replace_connection(self, connection)
UIDGenerator is used to generate unique message id.
It's a wrapper similar to zmsg.hpp in sense of encapsulation of hce message structure.
def __init__(self, connection, cmd_convertor)