本文整理汇总了Python中xmlrpclib.ServerProxy.getGenDataResult方法的典型用法代码示例。如果您正苦于以下问题:Python ServerProxy.getGenDataResult方法的具体用法?Python ServerProxy.getGenDataResult怎么用?Python ServerProxy.getGenDataResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpclib.ServerProxy
的用法示例。
在下文中一共展示了ServerProxy.getGenDataResult方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ErtRPCClient
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import getGenDataResult [as 别名]
class ErtRPCClient(object):
def __init__(self, host, port, verbose=False):
self._server_proxy = ServerProxy("http://%s:%s" % (host, port), allow_none=True, verbose=verbose)
socket.setdefaulttimeout(180) # 3 minutes
def ertVersion(self):
"""
Returns a version tuple: (major, minor, micro)
@rtype: tuple
"""
return tuple(self._server_proxy.ertVersion())
def getTimeMap(self, target_case_name):
"""
Returns a list of datetime objects for the named target case name
@type target_case_name: str
@rtype: list of datetime
"""
return self._server_proxy.getTimeMap(target_case_name)
def isRunning(self):
"""
Returns True if a simulation batch has been started and is running.
@rtype: bool
"""
return self._server_proxy.isRunning()
def isInitializationCaseAvailable(self):
"""
Returns True if the initialization case is prepared and ready to run simulations.
@rtype: bool
"""
return self._server_proxy.isInitializationCaseAvailable()
def startSimulationBatch(self, initialization_case_name, simulation_count):
"""
Start a simulation batch. Will prepare a batch that will run for the specified number of realizations.
Will fail if the server is already running a batch or no initialization case is available.
@param initialization_case_name: The case containing geo realizations
@type initialization_case_name: str
@type simulation_count: int
"""
try:
self._server_proxy.startSimulationBatch(initialization_case_name, simulation_count)
except Fault as f:
raise convertFault(f)
def addSimulation(self, target_case_name, geo_id, pert_id, sim_id, keywords):
"""
Start a simulation.
@type target_case_name: str
@type geo_id: int
@type pert_id:
@type sim_id: int
@type keywords: dict[str, list]
@raise UserWarning if the server is not ready to receive simulations
@raise UserWarning if the server is already running a simulation with the same id as sim_id
"""
try:
self._server_proxy.addSimulation(target_case_name, geo_id, pert_id, sim_id, keywords)
except Fault as f:
raise convertFault(f)
def isRealizationFinished(self, sim_id):
"""
Returns true if the realization is finished running.
@type sim_id: int
@rtype: bool
"""
return self._server_proxy.isRealizationFinished(sim_id)
def didRealizationSucceed(self, sim_id):
"""
Check if the realization successfully finished running.
@type sim_id: int
@rtype: bool
"""
return self._server_proxy.didRealizationSucceed(sim_id)
def didRealizationFail(self, sim_id):
"""
Check if the realization failed while running.
@type sim_id: int
@rtype: bool
"""
return self._server_proxy.didRealizationFail(sim_id)
def getGenDataResult(self, target_case_name, sim_id, report_step, keyword):
"""
Retrieve a GenData result from a target case
@type target_case_name: str
@type sim_id: int
@type report_step: int
@type keyword: str
@rtype: list[float]
#.........这里部分代码省略.........
示例2: ErtRPCClient
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import getGenDataResult [as 别名]
class ErtRPCClient(object):
def __init__(self, host, port, verbose=False):
self._server_proxy = ServerProxy("http://%s:%s" % (host, port), allow_none=True, verbose=verbose)
socket.setdefaulttimeout(180) # 3 minutes
def ertVersion(self):
"""
Returns a version tuple: (major, minor, micro)
@rtype: tuple
"""
return tuple(self._server_proxy.ertVersion())
def getTimeMap(self, target_case_name):
"""
Returns a list of datetime objects for the named target case name
@type target_case_name: str
@rtype: list of datetime
"""
return self._server_proxy.getTimeMap(target_case_name)
def isRunning(self):
"""
Returns True if a simulation batch has been started and is running.
@rtype: bool
"""
return self._server_proxy.isRunning()
def isInitializationCaseAvailable(self):
"""
Returns True if the initialization case is prepared and ready to run simulations.
@rtype: bool
"""
return self._server_proxy.isInitializationCaseAvailable()
def startSimulationBatch(self, initialization_case_name, simulation_count):
"""
Start a simulation batch. Will prepare a batch that will run for the specified number of realizations.
Will fail if the server is already running a batch or no initialization case is available.
@param initialization_case_name: The case containing geo realizations
@type initialization_case_name: str
@type simulation_count: int
"""
try:
self._server_proxy.startSimulationBatch(initialization_case_name, simulation_count)
except Fault as f:
raise convertFault(f)
def addSimulation(self, target_case_name, geo_id, pert_id, sim_id, keywords):
"""
Start a simulation.
@type target_case_name: str
@type geo_id: int
@type pert_id:
@type sim_id: int
@type keywords: dict[str, list]
@raise UserWarning if the server is not ready to receive simulations
@raise UserWarning if the server is already running a simulation with the same id as sim_id
"""
try:
self._server_proxy.addSimulation(target_case_name, geo_id, pert_id, sim_id, keywords)
except Fault as f:
raise convertFault(f)
def isRealizationFinished(self, sim_id):
"""
Returns true if the realization is finished running.
@type sim_id: int
@rtype: bool
"""
return self._server_proxy.isRealizationFinished(sim_id)
def didRealizationSucceed(self, sim_id):
"""
Check if the realization successfully finished running.
@type sim_id: int
@rtype: bool
"""
return self._server_proxy.didRealizationSucceed(sim_id)
def didRealizationFail(self, sim_id):
"""
Check if the realization failed while running.
@type sim_id: int
@rtype: bool
"""
return self._server_proxy.didRealizationFail(sim_id)
def getGenDataResult(self, target_case_name, sim_id, report_step, keyword):
"""
Retrieve a GenData result from a target case
@type target_case_name: str
@type sim_id: int
@type report_step: int
@type keyword: str
@rtype: list[float]
#.........这里部分代码省略.........