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
drce.CommandConvertor.TaskResponseDecoder Class Reference

Helper class is used for correct decoding data from json format in TaskResponse. More...

Inheritance diagram for drce.CommandConvertor.TaskResponseDecoder:
Collaboration diagram for drce.CommandConvertor.TaskResponseDecoder:

Public Member Functions

def decode (self, json_string, _w=json.decoder.WHITESPACE.match)
 decoding function More...
 

Private Member Functions

def __process_files (self, files_list)
 parse result_item files files More...
 

Detailed Description

Helper class is used for correct decoding data from json format in TaskResponse.

Definition at line 61 of file CommandConvertor.py.

Member Function Documentation

◆ __process_files()

def drce.CommandConvertor.TaskResponseDecoder.__process_files (   self,
  files_list 
)
private

parse result_item files files

Returns
list of files

Definition at line 99 of file CommandConvertor.py.

99  def __process_files(self, files_list):
100  files = []
101  for item in files_list:
102  files.append({"name":item["name"],
103  "data":item["data"],
104  "action":item["action"]})
105  return files
106 
107 
108 
Here is the caller graph for this function:

◆ decode()

def drce.CommandConvertor.TaskResponseDecoder.decode (   self,
  json_string,
  _w = json.decoder.WHITESPACE.match 
)

decoding function

Parameters
json_stringinput json string
Returns
TaskResponse

Definition at line 67 of file CommandConvertor.py.

67  def decode(self, json_string, _w=json.decoder.WHITESPACE.match):
68  default_obj = super(TaskResponseDecoder, self).decode(json_string, _w)
69  items = list()
70 
71  for response_item in default_obj:
72  response = ResponseItem()
73  response.error_code = response_item["error_code"]
74  response.error_message = response_item["error_message"]
75  response.id = response_item["id"]
76  response.type = response_item["type"]
77  response.host = response_item["host"]
78  response.port = response_item["port"]
79  response.state = response_item["state"]
80  response.pid = response_item["pid"]
81  response.stdout = response_item["stdout"]
82  response.stderror = response_item["stderror"]
83  response.exit_status = response_item["exit_status"]
84  response.files = self.__process_files(response_item["files"])
85  response.node = response_item["node"]
86  response.time = response_item["time"]
87  response.fields = response_item["fields"]
88 
89  items.append(response)
90 
91  task_response = TaskResponse(items)
92  return task_response
93 
94 
95 
Here is the call graph for this function:

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