Sends a request to launch a Tasklet on a {@link org.apache.reef.vortex.evaluator.VortexWorker}.
761740
<TInput, TOutput> void launchTasklet(final Tasklet<TInput, TOutput> tasklet) {
    assert !runningTasklets.containsKey(tasklet.getId());
    runningTasklets.put(tasklet.getId(), tasklet);

    if (tasklet.getAggregateFunctionId().isPresent()) {
      // function is aggregateable.
      final TaskletAggregateExecutionRequest<TInput> taskletAggregateExecutionRequest =
          new TaskletAggregateExecutionRequest<>(tasklet.getId(), tasklet.getAggregateFunctionId().get(),
              tasklet.getInput());
      vortexRequestor.sendAsync(reefTask, taskletAggregateExecutionRequest);
    } else {
      // function is not aggregateable.
      final TaskletExecutionRequest<TInput, TOutput> taskletExecutionRequest
          = new TaskletExecutionRequest<>(tasklet.getId(), tasklet.getUserFunction(), tasklet.getInput());
      vortexRequestor.sendAsync(reefTask, taskletExecutionRequest);
    }
  }
615747
@Override
  public void onNext(final Integer integer) {
    while (!runningWorkers.isTerminated()) {
      try {
        final Tasklet tasklet = pendingTasklets.takeFirst(); // blocks when no tasklet exists
        runningWorkers.launchTasklet(tasklet); // blocks when no worker exists
      } catch (InterruptedException e) {
        LOG.log(Level.INFO, "Interrupted upon termination");
      }
    }
  }
1283772
private synchronized void putDelegate(final List<Tasklet> tasklets, final VortexFutureDelegate delegate) {
    for (final Tasklet tasklet : tasklets) {
      taskletFutureMap.put(tasklet.getId(), delegate);
    }
  }
316620
public <T> ForkJoinTask<T> submit(ForkJoinTask<T> task) {
        if (task == null)
            throw new NullPointerException();
        doSubmit(task);
        return task;
    }
814750
@Override
	public T call() throws Exception {
		logger.debug("task '{}' starting", id);		
		try {
			// do the real work 
			return task.execute();
		} finally {
			// signal that the task is complete
			logger.debug("task '{}' is complete (queue size: {})", id, queue.size());
			queue.offer(id);			
		}
	}
1057509
protected <T extends RaftRequest, U extends RaftResponse> void sendRequest(T request, BiFunction<MemberId, T, CompletableFuture<U>> sender, CompletableFuture<U> future) {
    sendRequest(request, sender, 0, future);
  }
1259413
private VirtualMachine launchTarget() {
        LaunchingConnector launcher = (LaunchingConnector) connector;
        try {
            VirtualMachine new_vm = timedVirtualMachineCreation(() -> launcher.launch(connectorArgs), null);
            process = new_vm.process();
            return new_vm;
        } catch (Throwable ex) {
            throw reportLaunchFail(ex, "launch");
        }
    }
1053973
def start_thread(self, target, args=(), kwargs=None, priority=0):
        
        return self.add_task(target, args, kwargs, priority)
866884
@Override
  public void launchTask(final ExecutorDriver driver, final TaskInfo task) {
    driver.sendStatusUpdate(TaskStatus.newBuilder()
        .setTaskId(TaskID.newBuilder().setValue(this.mesosExecutorId).build())
        .setState(TaskState.TASK_STARTING)
        .setSlaveId(task.getSlaveId())
        .setMessage(this.mesosRemoteManager.getMyIdentifier())
        .build());
  }
719289
private void startNetworkingRequest() {
        Logger.v("Task[%s] start networking request", this);

        if (mExecutor != null) {
            final NetworkingPrioritizable<T> prioritizable = new NetworkingPrioritizable<T>(this);
            final NetworkingRequest<T> request = new NetworkingRequest<T>(prioritizable, mPriority.ordinal(), this);
            mExecutor.executeNetworkingRequest(request);
        } else {
            throw new IllegalStateException(Messages.NO_EXECUTOR);
        }
    }
1255259
public Future<V> submit(Callable<V> task) {
        if (task == null) throw new NullPointerException();
        NotifyingFuture<V> f = executor.submit(task);
        f.setListener(listener);
        return f;
    }
189104
void launchTaskJVM(TaskController.TaskControllerContext context) 
                                      throws IOException {
    JvmEnv env = context.env;
    List<String> wrappedCommand = 
      TaskLog.captureOutAndError(env.setup, env.vargs, env.stdout, env.stderr,
          env.logSize, true);
    ShellCommandExecutor shexec = 
        new ShellCommandExecutor(wrappedCommand.toArray(new String[0]), 
                                  env.workDir, env.env);
    // set the ShellCommandExecutor for later use.
    context.shExec = shexec;
    shexec.execute();
  }
1210876
def launch(self, task, **kwargs):
        
        if task.status == task.S_LOCKED:
            raise ValueError("You shall not submit a locked task!")

        # Build the task
        task.build()

        # Pass information on the time limit to Abinit (we always assume ndtset == 1)
        if isinstance(task, AbinitTask):
            args = kwargs.get("exec_args", [])
            if args is None: args = []
            args = args[:]
            args.append("--timelimit %s" % qu.time2slurm(self.qadapter.timelimit))
            kwargs["exec_args"] = args

        # Write the submission script
        script_file = self.write_jobfile(task, **kwargs)

        # Submit the task and save the queue id.
        try:
            qjob, process = self.qadapter.submit_to_queue(script_file)
            task.set_status(task.S_SUB, msg='Submitted to queue')
            task.set_qjob(qjob)
            return process

        except self.qadapter.MaxNumLaunchesError as exc:
            # TODO: Here we should try to switch to another qadapter
            # 1) Find a new parallel configuration in those stored in task.pconfs
            # 2) Change the input file.
            # 3) Regenerate the submission script
            # 4) Relaunch
            task.set_status(task.S_ERROR, msg="max_num_launches reached: %s" % str(exc))
            raise
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);
        }
    }
957107
@Override
	public void open(int taskNumber, int numTasks) {
		this.session = cluster.connect();
		MappingManager mappingManager = new MappingManager(session);
		this.mapper = mappingManager.mapper(outputClass);
		if (mapperOptions != null) {
			Mapper.Option[] optionsArray = mapperOptions.getMapperOptions();
			if (optionsArray != null) {
				mapper.setDefaultSaveOptions(optionsArray);
			}
		}
		this.callback = new FutureCallback<Void>() {
			@Override
			public void onSuccess(Void ignored) {
				onWriteSuccess();
			}

			@Override
			public void onFailure(Throwable t) {
				onWriteFailure(t);
			}
		};
	}
213710
private void sendRequest(InvocationRequest helpRequest, boolean startRemoteViewer) {
        this.helpRequest = helpRequest;
        
        if (helpRequest != null) {
            if (remoteViewerActive()) {
                remoteQueue.sendRequest(helpRequest);
                this.helpRequest = null;
            } else if (startRemoteViewer) {
                startRemoteViewer();
            } else {
                this.helpRequest = null;
            }
        }
    }
1210184
@Private
  @Override
  public void cancelled(final int pTaskletId) {
    assert taskletId == pTaskletId;

    this.cancelled.set(true);
    if (callbackHandler != null) {
      executor.execute(new Runnable() {
        @Override
        public void run() {
          callbackHandler.onFailure(new InterruptedException("VortexFuture has been cancelled on request."));
        }
      });
    }
    this.countDownLatch.countDown();
  }