コード例 #1
0
ファイル: exec.py プロジェクト: jbalint/spark
def startExecuteTask(agent, listener, taskname, arguments):
    if not isinstance(listener, ExecutionListener):
        listener = None
    newlistener = _SparkExecutionListener(agent, listener)
    debug("creating listener %s with parent %s", newlistener, listener)
    executor = XPSExecutor.getNonsparkExecutor()
    if executor == None:
        raise LowError("XPSExecutor nonsparkExecutor is not set")
    larguments = List(arguments)
    log_outgoing_request(newlistener, "executeTask", (newlistener, taskname, larguments))
    executor.executeTask(newlistener, taskname, toXPS(larguments))
    return newlistener
コード例 #2
0
ファイル: exec.py プロジェクト: jbalint/spark
def startExecuteTask(agent, listener, taskname, arguments):
    if not isinstance(listener, ExecutionListener):
        listener = None
    newlistener = _SparkExecutionListener(agent, listener)
    debug("creating listener %s with parent %s", newlistener, listener)
    executor = XPSExecutor.getNonsparkExecutor()
    if executor == None:
        raise LowError("XPSExecutor nonsparkExecutor is not set")
    larguments = List(arguments)
    log_outgoing_request(newlistener, "executeTask",
                         (newlistener, taskname, larguments))
    executor.executeTask(newlistener, taskname, toXPS(larguments))
    return newlistener
コード例 #3
0
ファイル: exec.py プロジェクト: jbalint/spark
def executingTask(parentListener, taskname, arguments):
    executor = XPSExecutor.getNonsparkExecutor()
    larguments = List(arguments)
    requestId = log_outgoing_request(None, "executingTask", (parentListener, taskname, larguments))
    listener = executor.executingTask(parentListener, taskname, toXPS(larguments))
    log_incoming_result(requestId, "result", listener)
    return listener
コード例 #4
0
ファイル: exec.py プロジェクト: jbalint/spark
def executingTask(parentListener, taskname, arguments):
    executor = XPSExecutor.getNonsparkExecutor()
    larguments = List(arguments)
    requestId = log_outgoing_request(None, "executingTask",
                                     (parentListener, taskname, larguments))
    listener = executor.executingTask(parentListener, taskname,
                                      toXPS(larguments))
    log_incoming_result(requestId, "result", listener)
    return listener
コード例 #5
0
def requestXMLRPC(agent, uri, name, parameters):
    import xmlrpclib
    debug("outgoing request %r %r %r", uri, name, parameters)
    try:
        requestId = log_outgoing_request(None, name, parameters)
        proxy = xmlrpclib.ServerProxy(uri, allow_none=True, verbose=True)
        origresult = getattr(proxy, name)(*encodeXMLValues(parameters))
        #print "xml-rpc", result
        result = decodeXMLValue(origresult)
        debug("incoming result %r", result)
        errnum = 0
    except IOError, e:
        debug("error creating proxy: %r", e)
        errnum, result = TRANSPORT_ERROR, "IOError for uri %r: %s"%(uri, e.strerror or e.message)
コード例 #6
0
ファイル: xps.py プロジェクト: jbalint/spark
def requestXPS(name, parameters):
    remote = XPSSolver.getNonsparkSolver()
    requestId = log_outgoing_request(None, name, parameters)
    if remote is None:
        errnum = ERR_SERVER_NOT_AVAILABLE
        result = "Remote XPS server is not available"
        log_incoming_result(requestId, errnum, result)
        return errnum, result
    f = remote.solveList(name, toXPS(parameters))
    try:
        objresult = f.get()
        result = fromXPS(objresult)
        errnum = NO_ERROR
    except ExecutionException, e:
        errnum = ERR_EXECUTION
        result = e.getMessage()
コード例 #7
0
ファイル: xps.py プロジェクト: junion/butlerbot-unstable
def requestXPS(name, parameters):
    remote = XPSSolver.getNonsparkSolver()
    requestId = log_outgoing_request(None, name, parameters)
    if remote is None:
        errnum = ERR_SERVER_NOT_AVAILABLE
        result = "Remote XPS server is not available"
        log_incoming_result(requestId, errnum, result)
        return errnum, result
    f = remote.solveList(name, toXPS(parameters))
    try:
        objresult = f.get()
        result = fromXPS(objresult)
        errnum = NO_ERROR
    except ExecutionException, e:
        errnum = ERR_EXECUTION
        result = e.getMessage()