本文整理汇总了Python中cpc.network.server_request.ServerRequest.prepareRequest方法的典型用法代码示例。如果您正苦于以下问题:Python ServerRequest.prepareRequest方法的具体用法?Python ServerRequest.prepareRequest怎么用?Python ServerRequest.prepareRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cpc.network.server_request.ServerRequest
的用法示例。
在下文中一共展示了ServerRequest.prepareRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addNodeAccepted
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def addNodeAccepted(self):
conf = ServerConf()
inf = open(conf.getCACertFile(), "r")
key = inf.read()
#only sending fqdn the requesting should already know the unqualified
# hostname
node = NodeConnectRequest(conf.getServerId(),
conf.getClientSecurePort(),
conf.getServerSecurePort(),
key,
conf.getFqdn(),
None)
cmdstring ='node-connection-accepted'
fields = []
input=Input('cmd',cmdstring)
input2=Input('connectRequest',
json.dumps(node,default=json_serializer.toJson,indent=4))
fields.append(input)
fields.append(input2)
fields.append(Input('version', "1"))
# this goes over client secure port , and we don't want the server to use
# cookies
response= self.postRequest(ServerRequest.prepareRequest(fields),
require_certificate_authentication=False,
disable_cookies=True)
return response
示例2: commandFinishedForwardedRequest
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def commandFinishedForwardedRequest(self, cmdID, workerServer,
projectServer, returncode,
cputime, haveData):
"""A server-to-sever request doing command-finished. Used in
forwarding non-local command-finished requests."""
cmdstring='command-finished-forward'
fields = []
input = Input('cmd', cmdstring)
fields.append(input)
fields.append(Input('cmd_id', cmdID))
fields.append(Input('version', "1"))
fields.append(Input('worker_server', workerServer))
fields.append(Input('project_server', projectServer))
if returncode is not None:
fields.append(Input('return_code', returncode))
fields.append(Input('used_cpu_time', cputime))
if haveData:
fields.append(Input('run_data', 1))
#the files are not sent in this message, instead they are pulled
# from the project server upon receiving this message (for now)
files = []
headers = dict()
#headers['end-node'] = self.host
#headers['end-node-port'] = self.port
#self.connect()
#log.debug("forwarding command finished to %s"%self.endNode)
response= self.putRequest(ServerRequest.prepareRequest(fields, files,
headers))
return response
示例3: __persistConnection
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def __persistConnection(self,direction,headers = dict()):
headers['persistent-connection'] = direction
#message body is actually irrellevant and is not read on the other
# side.
#we just need to conform to the http protocol
fields = []
fields.append(Input('cmd', "persist-connection"))
#sending along the connection parameters for this server
conf = ServerConf()
connectionParams = dict()
connectionParams['serverId'] = conf.getServerId()
connectionParams['hostname'] = conf.getHostName()
connectionParams['fqdn'] = conf.getFqdn()
connectionParams['client_secure_port'] = conf\
.getClientSecurePort()
connectionParams['server_secure_port'] = conf\
.getServerSecurePort()
input2 = Input('connectionParams',
json.dumps(connectionParams,default = json_serializer.toJson,
indent=4)) # a json structure that needs to be dumped
fields.append(input2)
response= self.putRequest(ServerRequest.prepareRequest(fields, [],
headers))
return response
示例4: projectGetDefaultRequest
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def projectGetDefaultRequest(self):
"""Get the default project project name"""
cmdstring="project-get-default"
fields = []
fields.append(Input('cmd', cmdstring))
fields.append(Input('version', "1"))
response= self.postRequest(ServerRequest.prepareRequest(fields, []))
return response
示例5: projectRollbackRequest
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def projectRollbackRequest(self, project):
"""Cancel a series of previously scheduled set&connect requests."""
cmdstring="project-rollback"
fields = []
fields.append(Input('cmd', cmdstring))
fields.append(Input('version', "1"))
response= self.postRequest(ServerRequest.prepareRequest(fields, []))
return response
示例6: listModules
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def listModules(self):
cmdString = "list-modules"
fields = []
input = Input('cmd',cmdString)
fields.append(input)
fields.append(Input('version', "1"))
msg = ServerRequest.prepareRequest(fields,[])
return self.postRequest(msg)
示例7: projectsRequest
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def projectsRequest(self):
"""List all projects"""
cmdstring="projects"
fields = []
fields.append(Input('cmd', cmdstring))
fields.append(Input('version', "1"))
response= self.postRequest(ServerRequest.prepareRequest(fields, []))
return response
示例8: projectCommitRequest
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def projectCommitRequest(self, project):
"""Commit a series of previously scheduled set&connect requests,
atomically."""
cmdstring="project-commit"
fields = []
fields.append(Input('cmd', cmdstring))
fields.append(Input('version', "1"))
response= self.postRequest(ServerRequest.prepareRequest(fields, []))
return response
示例9: serverInfo
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def serverInfo(self):
cmdstring='server-info'
fields = []
input = Input('cmd', cmdstring)
fields.append(input)
fields.append(Input('version', "1"))
msg = ServerRequest.prepareRequest(fields,[])
response= self.postRequest(msg)
return response
示例10: stopRequest
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def stopRequest(self):
cmdstring="stop"
fields = []
input = Input('cmd', cmdstring)
fields.append(input)
fields.append(Input('version', "1"))
response= self.postRequest(ServerRequest.prepareRequest(fields, []))
#response= self.putRequest(ServerRequest.prepareRequest(fields, []))
return response
示例11: projectStartRequest
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def projectStartRequest(self, name):
"""Start a new empty project """
cmdstring="project-start"
fields = []
fields.append(Input('cmd', cmdstring))
fields.append(Input('version', "1"))
fields.append(Input('name',name))
response= self.postRequest(ServerRequest.prepareRequest(fields, []))
return response
示例12: saveStateRequest
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def saveStateRequest(self):
"""Tell the server to save its state now."""
cmdstring="save-state"
fields = []
input = Input('cmd', cmdstring)
fields.append(input)
fields.append(Input('version', "1"))
response= self.postRequest(ServerRequest.prepareRequest(fields, []))
return response
示例13: readConfRequest
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def readConfRequest(self):
"""Tell the server to re-read its configuration."""
cmdstring="readconf"
fields = []
input = Input('cmd', cmdstring)
fields.append(input)
fields.append(Input('version', "1"))
response= self.postRequest(ServerRequest.prepareRequest(fields, []))
return response
示例14: deleteUser
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def deleteUser(self, user):
cmdstring="delete-user"
fields = []
input = Input('cmd', cmdstring)
fields.append(input)
fields.append(Input('user', user))
msg = ServerRequest.prepareRequest(fields,[])
response = self.postRequest(msg)
return response
示例15: revokeNode
# 需要导入模块: from cpc.network.server_request import ServerRequest [as 别名]
# 或者: from cpc.network.server_request.ServerRequest import prepareRequest [as 别名]
def revokeNode(self,serverId):
cmdString = "revoke-node"
fields = []
input = Input('cmd',cmdString)
fields.append(input)
fields.append(Input('version', "1"))
fields.append(Input('serverId',serverId))
msg = ServerRequest.prepareRequest(fields,[])
return self.postRequest(msg)