Add a new tasklet to pendingTasklets.
491147
@Override
  public <TInput, TOutput> VortexFuture<TOutput>
      enqueueTasklet(final VortexFunction<TInput, TOutput> function, final TInput input,
                     final Optional<FutureCallback<TOutput>> callback) {
    // TODO[REEF-500]: Simple duplicate Vortex Tasklet launch.
    final VortexFuture<TOutput> vortexFuture;
    final int id = taskletIdCounter.getAndIncrement();
    if (callback.isPresent()) {
      vortexFuture = new VortexFuture<>(executor, this, id, callback.get());
    } else {
      vortexFuture = new VortexFuture<>(executor, this, id);
    }

    final Tasklet tasklet = new Tasklet<>(id, Optional.<Integer>empty(), function, input, vortexFuture);
    putDelegate(Collections.singletonList(tasklet), vortexFuture);
    this.pendingTasklets.addLast(tasklet);

    return vortexFuture;
  }
1079
def add_pending_greenlet(self, greenlet: Greenlet):
        

        def remove(_):
            self.greenlets.remove(greenlet)

        self.greenlets.append(greenlet)
        greenlet.link_exception(self.on_error)
        greenlet.link_value(remove)
1049728
def _eager_tasklet(tasklet):
  """"""

  @utils.wrapping(tasklet)
  def eager_wrapper(*args, **kwds):
    fut = tasklet(*args, **kwds)
    _run_until_rpc()
    return fut

  return eager_wrapper
350652
def add_task(self, func, *args, **kargs):
        
        self.tasks_queue.put((func, args, kargs))
1283772
private synchronized void putDelegate(final List<Tasklet> tasklets, final VortexFutureDelegate delegate) {
    for (final Tasklet tasklet : tasklets) {
      taskletFutureMap.put(tasklet.getId(), delegate);
    }
  }
53172
function Thenable(then, thenable) {
			Pending.call(this);
			tasks.enqueue(new AssimilateTask(then, thenable, this));
		}
1221767
public void addTask(ReceivedMessageTask task) {
        tasks.add(task);
        Packet packet = task.getPacket();
        // don't run the deadlock guard if timeout is <= 0
        if (packet.getExpirationTime() > 0L) {
            // run a deadlock guard so hanging tasks will be interrupted
            task.runDeadlockFuture(new DeadlockGuard(task));
        }
        if (listener != null) {
            listener.onTaskAdded(this);
        }
    }
1227608
def _add_task(self, tile_address, coroutine):
        

        self.verify_calling_thread(True, "_add_task is not thread safe")

        if tile_address not in self._tasks:
            self._tasks[tile_address] = []

        task = self._loop.create_task(coroutine)
        self._tasks[tile_address].append(task)
1185466
def put_task(self, dp, callback=None):
        
        f = Future()
        if callback is not None:
            f.add_done_callback(callback)
        self.input_queue.put((dp, f))
        return f
1269272
def add_vts(self, task_name, targets, cache_key, valid, phase):
    
    if task_name not in self._task_reports:
      self.add_task(task_name)
    self._task_reports[task_name].add(targets, cache_key, valid, phase)
725774
async def pendings(self, tasks=None):
        
        tasks = tasks or self.todo_tasks
        await asyncio.gather(*tasks, loop=self.loop)
263778
def create_pending_tasks(self):
        
        for task in self.settings.tasks['setup']:
            self.setup_tasks.append(task)
            self.setup_results[task] = Result(task)

        if self.preset:
            for task in self.preset['tasks']:
                self.tasks.append(task)
                self.results[task] = Result(task)

        for task in self.settings.preview['tasks']:
            self.tasks.append(task)
            self.results[task] = Result(task)

        if self.preset:
            self.tasks.append(self.preset['daemon_task'])
            self.results[self.preset['daemon_task']] = Result(self.preset['daemon_task'])
666375
def num_pending_tasks(self):
        
        return len(self._status_tasks[PENDING]) + len(self._status_tasks[RUNNING])
606135
void registerTaskStarted(Task task) {
        synchronized (m_activeTasks) {
            String mapKey = createMapKey(task.getTenant(), task.getTaskID());
            if (m_activeTasks.put(mapKey, task) != null) {
                m_logger.warn("Task {} registered as started but was already running", mapKey);
            }
        }
    }
367468
public void addTaskRunOnce(int startDelayTime, Runnable runnable) {
        scheduledExecutorService.schedule(runnable, startDelayTime, TimeUnit.SECONDS);
    }
1234216
def add_task(self, task, parent_task_result):
        
        self.tasks.append((task, parent_task_result))
        self.task_id_to_task[task.id] = task
309219
public void scheduleTasklet(final int taskletId) {
    synchronized (stateLock) {
      // If there are tasklets are pending to be executed, then that means that a
      // timer has already been scheduled for an aggregation.
      if (!outstandingTasklets()) {
        timer.schedule(new Runnable() {
          @Override
          public void run() {
            aggregateTasklets(AggregateTriggerType.ALARM);
            synchronized (stateLock) {
              // On the callback, if there are tasklets pending to be executed, that means that this alarm
              // was triggered by a previous alarm, so we should continue to trigger more alarms. Otherwise
              // we are done with tasklets for this aggregation function for now.
              // If more tasklets for this aggregation function arrive, it will be triggered by the outer
              // call to timer.schedule.
              if (outstandingTasklets()) {
                timer.schedule(
                    this, taskletAggregationRequest.getPolicy().getPeriodMilliseconds(), TimeUnit.MILLISECONDS);
              }
            }
          }
        }, taskletAggregationRequest.getPolicy().getPeriodMilliseconds(), TimeUnit.MILLISECONDS);
      }

      // Add to pending tasklets, such that on the callback the timer can be refreshed.
      if (!pendingTasklets.containsKey(taskletId)) {
        pendingTasklets.put(taskletId, 0);
      }

      pendingTasklets.put(taskletId, pendingTasklets.get(taskletId) + 1);
    }
  }