Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.31 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. from tinyrpc.protocols.jsonrpc import JSONRPCProtocol
  5. from tinyrpc.transports.http import HttpPostClientTransport
  6. from tinyrpc import RPCClient
  7.  
  8. rpc_client = RPCClient(
  9.     JSONRPCProtocol(),
  10.     HttpPostClientTransport('http://127.0.0.1:5000/')
  11. )
  12.  
  13. remote_server = rpc_client.get_proxy()
  14.  
  15. import json
  16.  
  17.  
  18.  
  19. #this part sets up the experiemnt comment out after initial run through
  20. jsonTest = "{\"size\":{\"name\":\"size\",\"type\":\"int\",\"min\":0,\"max\":6,\"size\":1},\"window\":{\"name\":\"window\",\"type\":\"int\",\"min\":0,\"max\":5,\"size\":1},\"negative\":{\"name\":\"negative\",\"type\":\"int\",\"min\":0,\"max\":4,\"size\":1},\"alpha\":{\"name\":\"alpha\",\"type\":\"int\",\"min\":0,\"max\":4,\"size\":1},\"iter\":{\"name\":\"iter\",\"type\":\"int\",\"min\":0,\"max\":2,\"size\":1},\"sample\":{\"name\":\"sample\",\"type\":\"int\",\"min\":0,\"max\":10,\"size\":1}}"
  21. stupidDict = json.dumps({'maxIterations' : 10, 'num_jobs':4})
  22. result = remote_server.setupExperiment('slowTest', jsonTest, stupidDict)
  23. print result
  24.  
  25.  
  26.  
  27.  
  28. #this deposits one result at a time
  29. resultObject = {'negative': 1, 'iter': 1, 'sample': 6, 'window': 0, 'alpha': 4, 'size': 6}
  30.  
  31. resultObject['result'] = 0.25
  32. newresult = remote_server.depositResult('slowTest', resultObject)
  33. print newresult
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement