2 Created on Mar 19, 2014 6 @link: http://hierarchical-cluster-engine.com/ 7 @copyright: Copyright © 2013-2014 IOIX Ukraine 8 @license: http://hierarchical-cluster-engine.com/license/ 19 logger = logging.getLogger(APP_CONSTS.LOGGER_NAME)
34 if "command" in jsonData:
35 newObject.command = jsonData[
"command"]
37 raise Exceptions.DeserilizeException(
"NEW.command json-field not found")
39 newObject.id = int(jsonData[
"id"])
41 raise Exceptions.DeserilizeException(
"NEW.id json-field not found")
42 if "input" in jsonData:
43 newObject.input = jsonData[
"input"]
45 raise Exceptions.DeserilizeException(
"NEW.input json-field not found")
46 if "files" in jsonData:
47 if type(jsonData[
"files"]) !=
type([]):
48 raise Exceptions.DeserilizeException(
"NEW.files not list type")
49 newObject.files = jsonData[
"files"]
51 raise Exceptions.DeserilizeException(
"NEW.files json-field not found")
52 if "session" in jsonData:
53 if type(jsonData[
"session"]) !=
type({}):
54 raise Exceptions.DeserilizeException(
"NEW.session not dict type")
55 if newObject.session ==
None:
56 newObject.session = jsonData[
"session"]
58 for key
in jsonData[
"session"].keys():
59 newObject.session[key] = jsonData[
"session"][key]
61 raise Exceptions.DeserilizeException(
"NEW.session json-field not found")
62 if "strategy" in jsonData:
63 if type(jsonData[
"strategy"]) !=
type({}):
64 raise Exceptions.DeserilizeException(
"NEW.strategy not dict type")
65 if newObject.strategy ==
None:
66 newObject.strategy = jsonData[
"strategy"]
68 for key
in jsonData[
"strategy"].keys():
69 newObject.strategy[key] = jsonData[
"strategy"][key]
71 raise Exceptions.DeserilizeException(
"NEW.strategy json-field not found")
72 if "limits" in jsonData:
73 if type(jsonData[
"limits"]) !=
type({}):
74 raise Exceptions.DeserilizeException(
"NEW.limits not dict type")
75 if newObject.limits ==
None:
76 newObject.limits = jsonData[
"limits"]
78 for key
in jsonData[
"limits"].keys():
79 newObject.limits[key] = jsonData[
"limits"][key]
81 raise Exceptions.DeserilizeException(
"NEW.limits json-field not found")
82 if "autoCleanupFields" in jsonData:
83 if type(jsonData[
"autoCleanupFields"]) !=
type({}):
84 raise Exceptions.DeserilizeException(
"NEW.autoCleanupFields not dict type")
85 newObject.autoCleanupFields = jsonData[
"autoCleanupFields"]
95 raise Exceptions.DeserilizeException(
"CHECK.id json-field not found")
96 if "type" in jsonData:
97 checkObject.type = int(jsonData[
"type"])
99 raise Exceptions.DeserilizeException(
"CHECK.type json-field not found")
109 raise Exceptions.DeserilizeException(
"TERMINATE.id json-field not found")
110 if "alg" in jsonData:
111 deleteObject.alg = int(jsonData[
"alg"])
113 raise Exceptions.DeserilizeException(
"TERMINATE.alg json-field not found")
114 if "delay" in jsonData:
115 deleteObject.delay = int(jsonData[
"delay"])
117 raise Exceptions.DeserilizeException(
"TERMINATE.delay json-field not found")
118 if "repeat" in jsonData:
119 deleteObject.repeat = int(jsonData[
"repeat"])
121 raise Exceptions.DeserilizeException(
"TERMINATE.repeat json-field not found")
122 if "signal" in jsonData:
123 deleteObject.signal = int(jsonData[
"signal"])
125 raise Exceptions.DeserilizeException(
"TERMINATE.signal json-field not found")
126 if "host" in jsonData:
127 deleteObject.host = str(jsonData[
"host"])
129 raise Exceptions.DeserilizeException(
"TERMINATE.host json-field not found")
130 if "port" in jsonData:
131 deleteObject.port = int(jsonData[
"port"])
133 raise Exceptions.DeserilizeException(
"TERMINATE.port json-field not found")
134 if "action" in jsonData:
135 deleteObject.action = int(jsonData[
"action"])
137 raise Exceptions.DeserilizeException(
"TERMINATE.action json-field not found")
138 if "strategy" in jsonData:
139 if type(jsonData[
"strategy"]) !=
type({}):
140 raise Exceptions.DeserilizeException(
"TERMINATE.strategy not dict type")
141 if deleteObject.strategy ==
None:
142 deleteObject.strategy = jsonData[
"strategy"]
144 for key
in jsonData[
"strategy"].keys():
145 deleteObject.strategy[key] = jsonData[
"strategy"][key]
155 raise Exceptions.DeserilizeException(
"GET.id json-field not found")
156 if "type" in jsonData:
157 fetchObject.type = int(jsonData[
"type"])
159 raise Exceptions.DeserilizeException(
"GET.type json-field not found")
165 if "ids" in jsonData:
166 if type(jsonData[
"ids"]) !=
type([]):
167 raise Exceptions.DeserilizeException(
"STATUS.ids not list type")
170 raise Exceptions.DeserilizeException(
"STATUS.ids json-field not found")
171 if "filters" in jsonData:
172 if type(jsonData[
"filters"]) !=
type({}):
173 raise Exceptions.DeserilizeException(
"STATUS.filters not dict type")
174 statusObject.filters = jsonData[
"filters"]
176 raise Exceptions.DeserilizeException(
"STATUS.filters json-field not found")
177 if "strategy" in jsonData:
178 if type(jsonData[
"strategy"]) !=
type({}):
179 raise Exceptions.DeserilizeException(
"STATUS.strategy not dict type")
180 statusObject.strategy = jsonData[
"strategy"]
182 raise Exceptions.DeserilizeException(
"STATUS.strategy json-field not found")
191 raise Exceptions.DeserilizeException(
"CLEANUP.id json-field not found")
196 getTasksObject =
None 197 if "fetchNum" in jsonData:
200 raise Exceptions.DeserilizeException(
"GET_TASKS.fetchNum json-field not found")
201 if "fetchAdditionalFields" in jsonData:
202 getTasksObject.fetchAdditionalFields = bool(jsonData[
"fetchAdditionalFields"])
203 if "tableName" in jsonData:
204 getTasksObject.tableName = str(jsonData[
"tableName"])
205 if "criterions" in jsonData
and jsonData[
"criterions"]
is not None:
206 if type(jsonData[
"criterions"])
is not types.DictType:
207 raise Exceptions.DeserilizeException(
"GET_TASKS.criterions has wrong type")
208 if hasattr(getTasksObject.criterions,
'__iter__'):
209 getTasksObject.criterions.update(jsonData[
"criterions"])
211 getTasksObject.criterions = jsonData[
"criterions"]
212 return getTasksObject
DeleteTaskResults event object, for delete task results from DTM application operation.
def terminateDeserialize(self, jsonData)
def newDeserialize(self, jsonData)
newDeserialize method, deserializes incoming jsonData to the NewTask object jsonData - incoming json ...
NewTask event object, defines the Task object fields.
FetchTasksResults event object, for fetch task's results data from EE.
DTMCObjectsSerializator Class contents serialize/deserialize methods for incoming "DTMC" commands...
def getTasksDeserialize(self, jsonData)
DeleteTask event object, to delete task from DTM application and from EE.
def checkDeserialize(self, jsonData)
CheckTaskState event object, for check task status inside EE.
def getDeserialize(self, jsonData)
def cleanupDeserialize(self, jsonData)
GetTasksStatus event object, for check task status operation.
def statusDeserialize(self, jsonData)
FetchAvailabelTaskIds event object, for fetch available task id.