Adds a task to the pending queue
549756
@VisibleForTesting
  RemoteTaskRunnerWorkItem addPendingTask(final Task task)
  {
    log.info("Added pending task %s", task.getId());
    final RemoteTaskRunnerWorkItem taskRunnerWorkItem = new RemoteTaskRunnerWorkItem(
        task.getId(),
        task.getType(),
        null,
        null,
        task.getDataSource()
    );
    pendingTaskPayloads.put(task.getId(), task);
    pendingTasks.put(task.getId(), taskRunnerWorkItem);
    runPendingTasks();
    return taskRunnerWorkItem;
  }
812673
function(taskFn, taskParams) {
        var task = this._buildTask(taskFn, taskParams);

        if(task.params.weight > this._params.weightLimit) {
            throw Error('task with weight of ' +
                task.params.weight +
                ' can\'t be performed in queue with limit of ' +
                this._params.weightLimit);
        }

        this._enqueueTask(task);
        this._isStopped || this._scheduleRun();

        task.defer.promise().always(
            function() {
                this._stats.processingTasksCount--;
                this._stats.processedTasksCount++;
            },
            this);

        return task.defer.promise();
    }
502455
public synchronized void enqueue(DownloadTask task) {
        taskList.add(task);
        Collections.sort(taskList);

        if (!paused && !looping) {
            looping = true;
            startNewLooper();
        }
    }
71277
def add_done_callback(self, callback):
        
        if self._done is None or self._done.is_set():
            raise ValueError('Task has already finished')
        if callable(callback):
            self.callbacks.append(callback)
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);
        }
    }
1093152
def _send_tasks_and_stop_queuing(**kwargs):
    """"""
    log.info('Stopping queueing tasks and sending already queued ones.')
    _stop_queuing_tasks()
    task_queue = _get_task_queue()
    while task_queue:
        task, args, kwargs, extrakw = task_queue.pop(0)
        task.original_apply_async(args=args, kwargs=kwargs, **extrakw)
190764
protected void addTipToFinish(TaskInProgress tip,
                                TaskUmbilicalProtocol umbilicalProtocol) {
    long currentTime = System.currentTimeMillis();
    long finishTime = currentTime + Math.abs(rand.nextLong()) %
        timeToFinishTask;
    LOG.info("Adding TIP " + tip.getTask().getTaskID() +
        " to finishing queue with start time " +
        currentTime + " and finish time " + finishTime +
        " (" + ((finishTime - currentTime) / 1000.0) + " sec) to thread " +
        getName());
    TipToFinish ttf = new TipToFinish(tip, finishTime, umbilicalProtocol);
    tipQueue.put(ttf);
    // Interrupt the waiting thread. We could put in additional logic to only
    // interrupt when necessary, but probably not worth the complexity.
    this.interrupt();
  }
123179
def add_thread(self, checker, end_callback, source_code, parent):
        """"""
        parent_id = id(parent)
        thread = AnalysisThread(self, checker, source_code)
        self.end_callbacks[id(thread)] = end_callback
        self.pending_threads.append((thread, parent_id))
        logger.debug("Added thread %r to queue" % thread)
        QTimer.singleShot(50, self.update_queue)
1233299
def addTask(self, task):
        
        # Try to start task first.  If it fails then we don't need to
        # undo adding it to taskset
        task.initialize(self)
        task.start()

        with self._lock_c:
            self.numtasks += 1
            self.taskset.append(task)
545699
def queue(self, *args, **kwargs):
        
        self.scraper.task_manager.put(self, args, kwargs)
        return self
1053973
def start_thread(self, target, args=(), kwargs=None, priority=0):
        
        return self.add_task(target, args, kwargs, priority)
88476
def insert(self):
        
        from google.appengine.api.taskqueue import Queue

        task = self.to_task()

        Queue(name=self.get_queue()).add(task)
1322907
def put(self, value, priority=100):
        
        task_name = '{}{:03d}_{}'.format(self.TASK_PREFIX, priority, self._counter)
        path = posixpath.join(self._queue_path, task_name)
        self._client.kv[path] = value
53172
function Thenable(then, thenable) {
			Pending.call(this);
			tasks.enqueue(new AssimilateTask(then, thenable, this));
		}
725774
async def pendings(self, tasks=None):
        
        tasks = tasks or self.todo_tasks
        await asyncio.gather(*tasks, loop=self.loop)
974859
function addToQueue(queue, packageInfo) {
  var exists;

  function matchesVersion(version, range) {
    var matches;

    try {
      matches = semver.satisfies(packageInfo.version, item.version);
    }
    catch (err) {
      matches = false;
    }

    return matches;
  }

  exists = queue.some(function(item) {
    var matches = false;

    if (item.name === packageInfo.name) {
      matches = matchesVersion(packageInfo.version, item.version);
    }

    return matches;
  });

  if (!exists) {
    queue.push(packageInfo);
  }
}
164924
function addTaskToFluence(task, done) {
        if (done) {
            done = "1"
        } else {
            done = "0"
        }
        const query = `INSERT INTO ${todoTable} VALUES ('${task}', ${done})`;
        session.request(query).result().then((r) => {
            console.log("task inserted")
        })
    }