Example #1
0
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
Example #2
0
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
Example #3
0
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
Example #4
0
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
Example #5
0
def reportable(agent, tframe):          # returns listener or None
    """If this procedure is a learned one, return the listener for
    reporting its success or failure.
    If an ancestor is being reported, ask the bridge for a new listener.
    If not, use the listener recorded for the objective."""
    if not isLearnedProcedure(agent, tframe):
        debug("no need to report non-learned or top-level procedure %r for event %s", tframe, tframe.event())
        return None
    debug("must report learned procedure %r for event %s", tframe, tframe.event())
    (tf, listener) = ancestorListener(agent, tframe) or (None,None)
    if tf == None:
        return None
    executor = XPSExecutor.getNonsparkExecutor()
    taskname = tframe.event().goalsym().id
    taskargs = tframeInitialArguments(agent, tframe)
    newListener = executingTask(listener, taskname, taskargs)
    debug("obtained listener for %r: %r", tframe, newListener)
    return newListener
Example #6
0
def reportable(agent, tframe):  # returns listener or None
    """If this procedure is a learned one, return the listener for
    reporting its success or failure.
    If an ancestor is being reported, ask the bridge for a new listener.
    If not, use the listener recorded for the objective."""
    if not isLearnedProcedure(agent, tframe):
        debug(
            "no need to report non-learned or top-level procedure %r for event %s",
            tframe, tframe.event())
        return None
    debug("must report learned procedure %r for event %s", tframe,
          tframe.event())
    (tf, listener) = ancestorListener(agent, tframe) or (None, None)
    if tf == None:
        return None
    executor = XPSExecutor.getNonsparkExecutor()
    taskname = tframe.event().goalsym().id
    taskargs = tframeInitialArguments(agent, tframe)
    newListener = executingTask(listener, taskname, taskargs)
    debug("obtained listener for %r: %r", tframe, newListener)
    return newListener
Example #7
0
def setLoopback():  # for testing only
    XPSExecutor.setNonsparkExecutor(XPSExecutor.getSparkExecutor())
Example #8
0
                requestType = FAIL_REQUEST
                term = "Cannot find argument modes"
        #debug("initiating task via (%s, %r, %r, %r)", S_ExecuteTask.id, requestType, listener, term)
        self.agent.add_ephemeral(S_ExecuteTask, requestType, listener, term)

    def executingTask(self, parentListener, taskname, taskargs):
        requestId = log_incoming_request(
            None, "executingTask",
            (parentListener, taskname, fromXPS(taskargs)))
        listener = _SparkExecutionListener(self.agent, parentListener)
        debug("creating listener %s with parent %s", listener, parentListener)
        log_outgoing_result(requestId, "result", listener)
        return listener


XPSExecutor.setSparkExecutor(_SparkExecutor())


def setLoopback():  # for testing only
    XPSExecutor.setNonsparkExecutor(XPSExecutor.getSparkExecutor())


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)
Example #9
0
def setLoopback():                      # for testing only
    XPSExecutor.setNonsparkExecutor(XPSExecutor.getSparkExecutor())
Example #10
0
                debug("inargs = %r", inargs)
                term = Structure(symOrError, List(inargs))
            else:
                requestType = FAIL_REQUEST
                term = "Cannot find argument modes"
        #debug("initiating task via (%s, %r, %r, %r)", S_ExecuteTask.id, requestType, listener, term)
        self.agent.add_ephemeral(S_ExecuteTask, requestType, listener, term)

    def executingTask(self, parentListener, taskname, taskargs):
        requestId = log_incoming_request(None, "executingTask", (parentListener, taskname, fromXPS(taskargs)))
        listener = _SparkExecutionListener(self.agent, parentListener)
        debug("creating listener %s with parent %s", listener, parentListener)
        log_outgoing_result(requestId, "result", listener)
        return listener

XPSExecutor.setSparkExecutor(_SparkExecutor())

def setLoopback():                      # for testing only
    XPSExecutor.setNonsparkExecutor(XPSExecutor.getSparkExecutor())

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))