Exemple #1
0
 def executeTask(self, listener, taskname, taskargs):
     if self.agent == None:
         self.agent = G._AGENT
     staskargs = fromXPS(taskargs)
     log_incoming_request(listener, "executeTask",
                          (listener, taskname, staskargs))
     symOrError = taskNameToSymOrError(self.agent, taskname)
     if isString(symOrError):
         requestType = FAIL_REQUEST
         term = symOrError
     else:
         mode = optMode(self.agent, symOrError, ACTION_DO)
         if mode:
             requestType = "d"
             inargs = [
                 _if(usage == TERM_EVAL, x, None)
                 for (x, usage) in zip(staskargs, mode)
             ]
             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)
Exemple #2
0
 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
Exemple #3
0
 def executeTask(self, listener, taskname, taskargs):
     if self.agent == None:
        self.agent = G._AGENT
     staskargs = fromXPS(taskargs)
     log_incoming_request(listener, "executeTask", (listener, taskname, staskargs))
     symOrError = taskNameToSymOrError(self.agent, taskname)
     if isString(symOrError):
         requestType = FAIL_REQUEST
         term = symOrError
     else:
         mode = optMode(self.agent, symOrError, ACTION_DO)
         if mode:
             requestType = "d"
             inargs = [_if(usage == TERM_EVAL, x, None)
                       for (x, usage) in zip(staskargs, mode)]
             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)
Exemple #4
0
 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