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
ftest_ees_admin_requests.py
Go to the documentation of this file.
1 '''
2 Created on Mar 25, 2014
3 
4 @author: igor
5 '''
6 
7 from drce.Commands import TaskCheckRequest
8 from drce.CommandConvertor import CommandConvertor
9 from admin.Command import Command
10 from admin.Node import Node
11 from admin.NodeManagerRequest import NodeManagerRequest
12 from drce.Consts import SIMPLE_STATUS_INFO
13 import admin.Constants as consts
14 
16  commandConvertor = CommandConvertor()
17  request_id = "1"
18  task_check_request = TaskCheckRequest(request_id, SIMPLE_STATUS_INFO)
19 
20  return commandConvertor.to_json(task_check_request)
21 
22 
23 if __name__ == '__main__':
24  host = "127.0.0.1"
25  port = 10022
26  timeout = 1000
27 
28  node = Node(host, port)
29  hceNodeManagerRequest = NodeManagerRequest()
30 
31  command = Command(consts.COMMAND_NAMES.DRCE, [getCommand_json()],
32  consts.ADMIN_HANDLER_TYPES.DATA_PROCESSOR_DATA,
33  timeout)
34  requestBody = command.generateBody()
35  message = {consts.STRING_MSGID_NAME : "101", consts.STRING_BODY_NAME : requestBody}
36 
37  response = hceNodeManagerRequest.makeRequest(node, message)
38 
39  print response.__dict__
40  print "OK"
41 
Check task request.
Definition: Commands.py:169
NodeManagerRequest class contents all data needed for admin level's request sending.
Command class contents "commad" data and processing methods.
Definition: Command.py:16
Convertor which used to convert Task*Reques to json and TaskResponse from json.