Submit a Task that execute the command to a single Evaluator.
This method is called from <code>submitTask(cmd)</code>.
552251
private void submit(final ActiveContext context, final String command) {
    try {
      LOG.log(Level.INFO, "Send command {0} to context: {1}", new Object[]{command, context});
      final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
      cb.addConfiguration(
          TaskConfiguration.CONF
              .set(TaskConfiguration.IDENTIFIER, context.getId() + "_task")
              .set(TaskConfiguration.TASK, ShellTask.class)
              .build()
      );
      cb.bindNamedParameter(Command.class, command);
      context.submitTask(cb.build());
    } catch (final BindException ex) {
      LOG.log(Level.SEVERE, "Bad Task configuration for context: " + context.getId(), ex);
      context.close();
      throw new RuntimeException(ex);
    }
  }
571253
public static<T> Future<T> submit(Callable<T> task, String message) {
		logger.debug("Task " + (++tasks) + " submitted to shared thread pool. " + message);
		return getThreadPool().submit(task);
	}
266859
public void submitContextAndTask(final String evaluatorConfiguration,
                                   final String contextConfiguration,
                                   final String taskConfiguration) {
    this.launchWithConfigurationString(evaluatorConfiguration, contextConfiguration,
        Optional.<String>empty(), Optional.of(taskConfiguration));
  }
91629
def submit(self, *args, func=None, monitor=None):
        
        monitor = monitor or self.monitor
        func = func or self.task_func
        if not hasattr(self, 'socket'):  # first time
            self.__class__.running_tasks = self.tasks
            self.socket = Socket(self.receiver, zmq.PULL, 'bind').__enter__()
            monitor.backurl = 'tcp://%s:%s' % (
                config.dbserver.host, self.socket.port)
        assert not isinstance(args[-1], Monitor)  # sanity check
        dist = 'no' if self.num_tasks == 1 else self.distribute
        if dist != 'no':
            args = pickle_sequence(args)
            self.sent += numpy.array([len(p) for p in args])
        res = submit[dist](self, func, args, monitor)
        self.tasks.append(res)
3850
void runCheckAsync(final EvaluatorManager manager) {

    final String evaluatorId = manager.getId();
    LOG.log(Level.FINEST, "Idle check for Evaluator: {0}", manager);

    this.executor.submit(new Runnable() {

      @Override
      public void run() {

        LOG.log(Level.FINEST, "Idle check for Evaluator {0} - begin", evaluatorId);

        while (!manager.isClosed()) {
          try {

            LOG.log(Level.FINEST,
                "Waiting for Evaluator {0} to close: Sleep for {1} ms",
                new Object[] {evaluatorId, waitInMillis});

            Thread.sleep(waitInMillis);

          } catch (final InterruptedException e) {
            LOG.log(Level.SEVERE, "Thread interrupted while waiting for Evaluator to finish.");
            throw new RuntimeException(e);
          }
        }

        manager.checkIdlenessSource();

        LOG.log(Level.FINEST, "Idle check for Evaluator {0} - end", evaluatorId);
      }

      @Override
      public String toString() {
        return "CheckIdle: " + evaluatorId;
      }
    });
  }
1276077
private <T> void submitCommand(CommandRequest request, CompletableFuture<T> future) {
    submit(new CommandAttempt<>(sequencer.nextRequest(), request, future));
  }
1294693
public <T> T submit(final Callable<T> callable) {
        if (taskExecutor instanceof ForkJoinPool) {
            try {

                return ((ForkJoinPool) taskExecutor).submit(callable)
                                                    .get();
            } catch (final ExecutionException e) {
                throw ExceptionSoftener.throwSoftenedException(e);

            } catch (final InterruptedException e) {
                Thread.currentThread()
                      .interrupt();
                throw ExceptionSoftener.throwSoftenedException(e);

            }
        }
        try {
            return callable.call();
        } catch (final Exception e) {
            throw new RuntimeException(
                                       e);
        }
    }
755706
public static int runCommand(final CCTask task, final File workingDir, final String[] cmdline,
      final boolean newEnvironment, final Environment env) throws BuildException {
    try {
      task.log(Commandline.toString(cmdline), task.getCommandLogLevel());

     /* final Execute exe = new Execute(new LogStreamHandler(task, Project.MSG_INFO, Project.MSG_ERR));
      if (System.getProperty("os.name").equals("OS/390")) {
        exe.setVMLauncher(false);
      }
      exe.setAntRun(task.getProject());
      exe.setCommandline(cmdline);
      exe.setWorkingDirectory(workingDir);
      if (env != null) {
        final String[] environment = env.getVariables();
        if (environment != null) {
          for (final String element : environment) {
            task.log("Setting environment variable: " + element, Project.MSG_VERBOSE);
          }
        }
        exe.setEnvironment(environment);
      }
      exe.setNewenvironment(newEnvironment);
      return exe.execute();
            */
	  return CommandExecution.runCommand(cmdline,workingDir,task);
    } catch (final java.io.IOException exc) {
      throw new BuildException("Could not launch " + cmdline[0] + ": " + exc, task.getLocation());
    }
  }
416366
private Object execute(Object o, Method m, Object... args) throws CommandActionExecutionException {
        Object result = null;
        try {
            m.setAccessible(true); // suppress Java language access
            if (isCompileWeaving() && metaHolder.getAjcMethod() != null) {
                result = invokeAjcMethod(metaHolder.getAjcMethod(), o, metaHolder, args);
            } else {
                result = m.invoke(o, args);
            }
        } catch (IllegalAccessException e) {
            propagateCause(e);
        } catch (InvocationTargetException e) {
            propagateCause(e);
        }
        return result;
    }
658177
public Future<?> submitAfter(Waiter waiter, Runnable runnable, long timeout, TimeUnit unit)
    {
        AfterTask<?> task = new AfterTask<>(waiter, runnable, timeout, unit);
        log(logLevel, "submit after task %s", task);
        return submit(task);
    }
81408
public synchronized void submitTask(final ActiveContext context) {
    final TaskEntity task = taskQueue.poll();
    final Integer taskId = task.getId();
    final String command = task.getCommand();

    final Configuration taskConf = TaskConfiguration.CONF
        .set(TaskConfiguration.TASK, ShellTask.class)
        .set(TaskConfiguration.IDENTIFIER, taskId.toString())
        .build();
    final Configuration commandConf = Tang.Factory.getTang().newConfigurationBuilder()
        .bindNamedParameter(Command.class, command)
        .build();

    final Configuration merged = Configurations.merge(taskConf, commandConf);
    context.submitTask(merged);
    runningTasks.add(task);
  }
1221259
public void execute(Runnable task, long timeoutMillis) throws RejectedExecutionException {
        if (task == null) {
            throw new NullPointerException("Cannot accept null task");
        }
        synchronized (this) {
            if (mState != STATE_RUNNING && mState != STATE_NOT_STARTED) {
                throw new RejectedExecutionException("Task queue is shutdown");
            }
        }
        try {
            if (!mQueue.offer(task, timeoutMillis, TimeUnit.MILLISECONDS)) {
                throw new RejectedExecutionException("Unable to enqueue task after waiting " +
                                                     timeoutMillis + " milliseconds");
            }
        } catch (InterruptedException e) {
            throw new RejectedExecutionException(e);
        }
    }
189875
void execute(ExecutableBuilder builder,
            int timeout,
            TimeUnit unit) throws
            CommandLineException,
            InterruptedException, ExecutionException, TimeoutException {
        Future<Void> task = executorService.submit(() -> {
            builder.build().execute();
            return null;
        });
        try {
            if (timeout <= 0) { //Synchronous
                task.get();
            } else { // Guarded execution
                try {
                    task.get(timeout, unit);
                } catch (TimeoutException ex) {
                    // First make the context unusable
                    CommandContext c = builder.getCommandContext();
                    if (c instanceof TimeoutCommandContext) {
                        ((TimeoutCommandContext) c).timeout();
                    }
                    // Then cancel the task.
                    task.cancel(true);
                    throw ex;
                }
            }
        } catch (InterruptedException ex) {
            // Could have been interrupted by user (Ctrl-C)
            Thread.currentThread().interrupt();
            cancelTask(task, builder.getCommandContext(), null);
            // Interrupt running operation.
            CommandContext c = builder.getCommandContext();
            if (c instanceof TimeoutCommandContext) {
                ((TimeoutCommandContext) c).interrupted();
            }
            throw ex;
        }
    }
296789
public static void SubmitDelayed( long millis, Runnable task ) {
        Actors.delayedCalls.schedule( new TimerTask() {
            @Override
            public void run() {
                task.run();
            }
        },millis);
    }
53832
private void submitTask(@NotNull State<T, R> state, @NotNull BatchItem item, @NotNull Link auth) {
    // Submit task
    final StateHolder holder = new StateHolder(state);
    try {
      state.auth = auth;
      final Work<R> worker = objectTask(state, item);
      if (state.future.isDone()) {
        holder.close();
        return;
      }
      if (worker == null) {
        throw new IllegalStateException("Uncompleted task worker is null: " + item);
      }
      executeInPool(
          "task: " + state.getMeta().getOid(),
          () -> processObject(state, auth, worker),
          holder::close,
          true
      );
    } catch (Throwable e) {
      holder.close();
      throw e;
    }
  }
302353
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties)
        throws RemoteException
    {
        String strCommand = this.getProperty(REMOTE_COMMAND, properties);
        if (MAKE_REMOTE_TABLE.equals(strCommand))
        {
            String strRecordClassName = this.getNextStringParam(in, NAME, properties);
            String strTableSessionClassName = this.getNextStringParam(in, SESSION_CLASS_NAME, properties);
            Map<String,Object> propIn = this.getNextPropertiesParam(in, PROPERTIES, properties);
            Map<String,Object> propDatabase = this.getNextPropertiesParam(in, PROPERTIES_DB, properties);
            if (propIn != null)
                properties.putAll(propIn);
            RemoteTable remoteTable = ((RemoteTask)m_remoteObject).makeRemoteTable(strRecordClassName, strTableSessionClassName, properties, propDatabase);
            String strTableID = this.add(new TableHolder(this, remoteTable));
            this.setReturnString(out, strTableID);
        }
        else if (CREATE_REMOTE_TASK.equals(strCommand))
        {   // Note: I am not the parent, the proxyTask (the application task) is.
            Map<String,Object> propIn = this.getNextPropertiesParam(in, PROPERTIES, properties);
            if (propIn != null)
                properties.putAll(propIn);
            Application app = ((TaskSession)this.getRemoteObject()).getApplication();
            RemoteTask remoteTask = m_proxyTask.getNewRemoteTask(app, properties);  // Parent is MY APPLICATION not ME.
            String strUniqueID = m_proxyTask.add(new TaskHolder(m_proxyTask, remoteTask));  // Parent is Parent Proxy not ME.
            out.write(strUniqueID);
        }
        else if (CREATE_REMOTE_RECEIVE_QUEUE.equals(strCommand))
        {
            String strQueueName = this.getNextStringParam(in, MessageConstants.QUEUE_NAME, properties);
            String strQueueType = this.getNextStringParam(in, MessageConstants.QUEUE_TYPE, properties);
            RemoteReceiveQueue remoteReceiveQueue = ((RemoteTask)m_remoteObject).createRemoteReceiveQueue(strQueueName, strQueueType);
            String strID = this.find(remoteReceiveQueue);
            if (strID == null)
                strID = this.add(new ReceiveQueueHolder(this, remoteReceiveQueue));
            this.setReturnString(out, strID);
        }
        else if (CREATE_REMOTE_SEND_QUEUE.equals(strCommand))
        {
            String strQueueName = this.getNextStringParam(in, MessageConstants.QUEUE_NAME, properties);
            String strQueueType = this.getNextStringParam(in, MessageConstants.QUEUE_TYPE, properties);
            RemoteSendQueue remoteSendQueue = ((RemoteTask)m_remoteObject).createRemoteSendQueue(strQueueName, strQueueType);
            String strID = this.find(remoteSendQueue);
            if (strID == null)
                strID = this.add(new SendQueueHolder(this, remoteSendQueue));
            this.setReturnString(out, strID);
        }
        else if (SET_REMOTE_MESSAGE_TASK.equals(strCommand))
        {
            String strTaskID = this.getNextStringParam(in, ID, properties);
            BaseHolder sessionHolder = this.getSessionFromPath(strTaskID);
            if (sessionHolder instanceof TaskHolder)
            {       // Always
                RemoteTask remoteTask = (RemoteTask)sessionHolder.getRemoteObject();
                ((RemoteTask)m_remoteObject).setRemoteMessageTask(remoteTask);
            }
            else
                Utility.getLogger().warning("Remote session not found");
        }
        else if (LOGIN.equals(strCommand))
        {
            String strUserName = this.getNextStringParam(in, Params.USER_NAME, properties);
            String strPassword = this.getNextStringParam(in, Params.PASSWORD, properties);
            String strDomain = this.getNextStringParam(in, Params.DOMAIN, properties);
            Map<String,Object> mapLoginInfo = ((RemoteTask)m_remoteObject).login(strUserName, strPassword, strDomain);
            // First, see if this is in my list already?
            this.setReturnObject(out, mapLoginInfo);
        }
        else
            super.doProcess(in, out, properties);
    }
1331214
private void runCommand(TaskCommands taskCommand, String user,
      List<String> cmdArgs, File workDir, Map<String, String> env)
      throws IOException {

    ShellCommandExecutor shExec =
        buildTaskControllerExecutor(taskCommand, user, cmdArgs, workDir, env);
    try {
      shExec.execute();
    } catch (Exception e) {
      LOG.warn("Exit code from " + taskCommand.toString() + " is : "
          + shExec.getExitCode());
      LOG.warn("Exception thrown by " + taskCommand.toString() + " : "
          + StringUtils.stringifyException(e));
      LOG.info("Output from LinuxTaskController's " + taskCommand.toString()
          + " follows:");
      logOutput(shExec.getOutput());
      throw new IOException(e);
    }
    if (LOG.isDebugEnabled()) {
      LOG.info("Output from LinuxTaskController's " + taskCommand.toString()
          + " follows:");
      logOutput(shExec.getOutput());
    }
  }