Get all tasks present in the queue.
971630
def _get_avaliable_tasks(self):
        """"""
        base_task = posixpath.join(self._queue_path, self.TASK_PREFIX)
        tasks = self._client.kv.find(prefix=base_task)
        return sorted(tasks.items())
859358
function () {
    var self = this;

    // See how much capacity we have left to fill.
    var launchCount = this.concurrency - Object.keys(this.active).length;

    // Identify up to launchCount eligible tasks, giving priority to those earlier in the queue.
    var offset = 0;
    var launchTasks = [];
    while (launchTasks.length < launchCount && this.tasks.length > offset) {
      var task = this.tasks[offset];

      if (task.key in this.active) {
        // This task cannot run right now, so skip it.
        offset += 1;
      } else {
        // This task is eligible to run. Remove it from the queue and prepare it to launch.
        this.tasks.splice(offset, 1);
        launchTasks.push(task);
      }
    }

    // Create a task completion callback. Remove the task from the active set, invoke the tasks'
    // push() callback, then drain() again to see if another task is ready to run.
    function makeTaskHandler(task) {
      return function (err) {
        delete self.active[task.key];

        task.callback(err);

        // Defer the next drain() call again in case the task's callback was synchronous.
        process.nextTick(self.drain.bind(self));
      };
    }

    // Launch the queue handler for each chosen task.
    for (var i = 0; i < launchTasks.length; i++) {
      var each = launchTasks[i];

      this.active[each.key] = each;

      this.handler(each.job, each.config, makeTaskHandler(each));
    }

    // Fire and unset the drain callback if one has been registered.
    if (this.drainCallback) {
      var lastCallback = this.drainCallback;
      this.drainCallback = null;
      lastCallback();
    }
  }
164515
def clear(self):
        
        with self.__lock:
            # Empty the current queue
            try:
                while True:
                    self._queue.get_nowait()
                    self._queue.task_done()
            except queue.Empty:
                # Queue is now empty
                pass

            # Wait for the tasks currently executed
            self.join()
411061
def get_task_subtasks(self, task_id, completed=False):
        '''  '''
        return subtasks_endpoint.get_task_subtasks(self, task_id, completed=completed)
152307
def tasks(self):
        """"""
        tasks = set()
        for ctrl in self.controllers.values():
            tasks.update(ctrl.tasks)
        return tasks
560659
def get_tasks(self):
        

        def predicate(item):
            return (inspect.isfunction(item) and
                    item.__name__ not in self._helper_names)
        return inspect.getmembers(self._tasks, predicate)
781592
def tasks():
    ''''''
    tasks = get_tasks()
    longest = max(tasks.keys(), key=len)
    size = len(longest)
    for name, queue in sorted(tasks.items()):
        print('* {0}: {1}'.format(name.ljust(size), queue))
1157711
def fetch(self):
        
        params = values.of({})

        payload = self._version.fetch(
            'GET',
            self._uri,
            params=params,
        )

        return TaskQueueInstance(
            self._version,
            payload,
            workspace_sid=self._solution['workspace_sid'],
            sid=self._solution['sid'],
        )
217411
def get_all_tasks(self, subsystem):
        
        with open(os.path.join(self.per_subsystem[subsystem], 'tasks'), 'r') as tasksFile:
            for line in tasksFile:
                yield int(line)
53979
def get_task_subtasks(client, task_id, completed=False):
    '''  '''
    params = {
            'task_id' : int(task_id),
            'completed' : completed,
            }
    response = client.authenticated_request(client.api.Endpoints.SUBTASKS, params=params)
    return response.json()
765997
private List<Task> receiveTasks() {
		synchronized (mutex) {
			if (tasks.isEmpty()) {
				return Collections.emptyList();
			} else {
				List<Task> currentTasks = tasks;
				tasks = new ArrayList<Task>();
				return currentTasks;
			}
		}
	}
1148406
def result(self):
        """"""
        if not self.tasks:
            self.clean_all()
        tasks_length = len(self.tasks)
        self.logger_function(
            '%s tasks of request, will cost at least %s seconds.' %
            (tasks_length,
             round(self.req.interval / self.req.n * tasks_length, 2)))
        self.req.x
        for task in self.tasks:
            key, value, fut = task
            if fut.x and fut.cx:
                # fut.x == req success & fut.cx == response not changed.
                self.ignore[key].append(value)
        return self.reset_new_request()
598549
def to_task(self):
    """"""
    # Never pass params to taskqueue.Task. Use payload instead. Otherwise,
    # it's up to a particular taskqueue implementation to generate
    # payload from params. It could blow up payload size over limit.
    return taskqueue.Task(
        url=self.url,
        payload=self._payload,
        name=self.name,
        eta=self.eta,
        countdown=self.countdown,
        headers=self._headers)
1182222
def tasks(self):
        
        if self._tasks is None:
            self._tasks = TaskList(self._version, workspace_sid=self._solution['sid'], )
        return self._tasks
876652
def results(self):
        """"""
        tt = None
        for i, tf in enumerate(self[:-1]):
            tt = self[i+1]
            q = Queue(tf.qsize)
            tf.set_out(q, tt.workers)
            tt.set_in(q, tf.workers)

        if tt is None: # we have only one pool
            tt = self[0]
        q = Queue(tt.qsize)
        err_q = Queue()
        tt.set_out(q, 1)

        for t in self:
            t.set_err(err_q)
            t._start()

        for item in iterqueue(q, tt.workers):
            yield item

        errors = list(iterqueue(err_q, sum(t.workers for t in self)))

        for t in self:
            t._join()

        if len(errors) > 0:
            task_name, ex = errors[0]
            if len(errors) == 1:
                msg = 'The task "%s" raised %s' % (task_name, repr(ex),)
            else:
                msg = '%d tasks raised an exeption. First error reported on task "%s": %s' % (len(errors), task_name, repr(ex))

            raise TaskException(msg)
753115
def _consume(self):
        
        while True:
            try:
                task, args, kwargs = self.queue.get(True)
                task(*args, **kwargs)
            finally:
                self.queue.task_done()
1207274
def run_tasks(self):
        '''
        
        '''
        pool = Pool(len(self.tasks))
        for task in self.tasks:
            # Launch a green thread to schedule the task
            # A task will be managed by 2 green thread: execution thread and scheduling thread
            pool.spawn(self.run, task)
        return pool