Get a task from the queue.
977103
def get(self):
        """"""
        tasks = self._get_avaliable_tasks()
        if not tasks:
            return None
        name, data = tasks[0]
        self._client.kv.delete(name)
        return data
1084725
public void cancelQueuedTasks() {
      ArrayList<QueueingTask> queuedTasks = new ArrayList<QueueingTask>();
      queue.drainTo(queuedTasks);
      for (QueueingTask task : queuedTasks) {
         task.cancel(false);
      }
   }
727562
function runQueue() {
		var lastReturned = returned instanceof Array ? returned : [returned]
		  , tasks = queued.shift();

		if (tasks) tasks = tasks.tasks;
		returned = undefined;

		if (tasks instanceof Array) {
			for (var t=0,tt=tasks.length; t<tt; t++) {
				tasks[t].apply(taskObject(t),lastReturned);
			};
			return;
		}
		if (typeof tasks == 'object') {
			for (var t in tasks) if (tasks.hasOwnProperty(t)) {
				tasks[t].apply(taskObject(t),lastReturned);
			}
			return;
		}
	}
378134
private AuditUtilityTask getTask(String taskName) {
        AuditUtilityTask task = null;
        for (AuditUtilityTask availTask : tasks) {
            if (availTask.getTaskName().equals(taskName)) {
                task = availTask;
            }
        }
        return task;
    }
666294
def send_result(self, type, task, result):
        ''''''
        if self.outqueue:
            try:
                self.outqueue.put((task, result))
            except Exception as e:
                logger.exception(e)
453042
private static Runnable nextTask() {
		synchronized (lock) {
			// Block until we have another object in the queue to execute.
			while (taskList.isEmpty()) {
				try {
					lock.wait();
				} catch (InterruptedException ie) {
				}
			}
			return (Runnable) taskList.removeLast();
		}
	}
575994
def queue(self):
        """"""
        with self.connection_pool.acquire(block=True) as conn:
            return Q(
                self.routing_key,
                exchange=self.exchange,
                routing_key=self.routing_key
            )(conn)
81034
def task(self):
        
        # If we have no .task_id, this is a no-op to return None.
        if not self.task_id:
            return defer.succeed(None)
        return self.connection.getTaskInfo(self.task_id)
249374
def find_task(self, request, context):
        """"""
        _log_request(request, context)
        task = self.listener.memory.tasks.get(request.task_uuid)
        if not task:
            return clearly_pb2.TaskMessage()
        return ClearlyServer._event_to_pb(task)[1]
629789
public static TaskQueue getInstance( ILogger logger, String strQueueName )
  {
    if( strQueueName == null )
    {
      return null;
    }

    TaskQueue taskQueue = QUEUE_MAP.get( strQueueName );
    if( taskQueue == null )
    {
      taskQueue = new TaskQueue( logger, strQueueName );
      QUEUE_MAP.put( strQueueName, taskQueue );
    }

    return taskQueue;
  }
82921
def enqueue_task(task)
      RRRSpec.redis.rpush(RRRSpec.make_key(key, 'task_queue'), task.key)
    end
882952
def pop(self, queue_name):
        
        cls = self.__class__
        queue = cls.queues.get(queue_name, [])

        if queue:
            task_id = queue.pop(0)
            return cls.task_data.pop(task_id, None)
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);			
		}
	}
391064
def get(method, hmc, uri, uri_parms, logon_required):
        """"""
        query_str = uri_parms[0]
        try:
            console = hmc.consoles.lookup_by_oid(None)
        except KeyError:
            raise InvalidResourceError(method, uri)
        result_tasks = []
        filter_args = parse_query_parms(method, uri, query_str)
        for task in console.tasks.list(filter_args):
            result_task = {}
            for prop in task.properties:
                if prop in ('element-uri', 'name'):
                    result_task[prop] = task.properties[prop]
            result_tasks.append(result_task)
        return {'tasks': result_tasks}
198442
public Task poll() {
        Task result = taskList[activeIndex].poll();
        if (result != null) {
            if (activeIndex == 0)
                result.removeFromQueue0();
            else
                result.removeFromQueue1();
        }

        return result;
    }
819440
@Override
    public synchronized Task take() throws TimeoutException {
        try {
            Task task = queue.remove();
            inprocess.add(task);
            return task;
        } catch (NoSuchElementException ex) {
            throw new TimeoutException(ex);
        }
    }
1189788
def maybe_put_task(self):
        """"""
        try:
            task = next(self.tasks)
        except StopIteration:
            pass
        else:
            log.debug('Putting %s on queue', task)
            self.task_queue.put(task)