Run all pending tasks; 'force' will run all tasks whether they're
        pending or not.
480113
def run(self, force=False):
        
        now = time.time()
        for func, spec in self.tasks.items():
            if force or now >= spec.get('next_run', 0):
                func()
                spec['next_run'] = now + spec['interval']
422854
public void run() {
        Runnable r = null;
        while (true) {
            // Try to drain the maximum capacity of thread-local items, checking
            // whether any were available
            if (workQueue.drainTo(internalQueue, threadLocalItems) == 0) {
                // block until a work item is available
                try {
                    internalQueue.offer(workQueue.take());
                } catch (InterruptedException ie) {
                    throw new Error(ie);
                }
            }
            // Execute all of the thread-local items
            while ((r = internalQueue.poll()) != null)
                r.run();
        }
    }
181748
def run(self):
        

        services = Service.objects.all()
        for service in services:
            service_metric_sync.apply_async(
                kwargs={"service_id": str(service.id)})

            key = "services.downtime.%s.sum" % (
                utils.normalise_string(service.name))
            check = WidgetData.objects.filter(service=None, key=key)
            if not check.exists():
                WidgetData.objects.create(
                    key=key,
                    title="TEMP - Pending update"
                )

        return "Queued <%s> Service(s) for Metric Sync" % services.count()
1233504
def cancel_pending_tasks(self):
        """"""
        for task in self._pending_tasks:
            task.cancel()
            if not self._loop.is_running():
                try:
                    self._loop.run_until_complete(task)
                except asyncio.CancelledError:
                    pass
                except Exception: # pylint: disable=broad-except
                    _LOGGER.error("Unhandled exception from async task",
                                  exc_info=True)
11828
def _run(self):
        ''''''
      
        while self._is_running:
            yield from self._task()

        # Signal that the loop has finished.
        self._run_complete.set_result(True)
151975
def run(*tasks: Awaitable, loop: asyncio.AbstractEventLoop=asyncio.get_event_loop()):
    
    futures = [asyncio.ensure_future(task, loop=loop) for task in tasks]
    return loop.run_until_complete(asyncio.gather(*futures))
470767
@GuardedBy("evictionLock")
    void runTasks(Task[] tasks, int maxTaskIndex) {
        for (int i = 0; i <= maxTaskIndex; i++) {
            runTasksInChain(tasks[i]);
        }
    }
724801
async def start(self):
        
        for track, context in self.__tracks.items():
            if context.task is None:
                context.task = asyncio.ensure_future(self.__run_track(track, context))
221668
public void run() {
        try {

            Queue<ParallelTask> waitQ = ParallelTaskManager.getInstance()
                    .getWaitQ();

            logger.debug(
                    "TASK_WAIT_Q: Current waitQ has task count: {} in Thread scheduler",
                    waitQ.size());

            final ParallelTask task = waitQ.peek();
            if (task != null) {

                int totalUsedCapacityBefore = ParallelTaskManager.getInstance()
                        .getTotalUsedCapacity();

                int capacityThisTask = task.capacityUsed();
                int capacityRemain = ParallecGlobalConfig.maxCapacity
                        - totalUsedCapacityBefore;
                int totalUsedCapacityNew = totalUsedCapacityBefore
                        + capacityThisTask;

                logger.info(
                        "TASK_WAIT_Q: Exists Task in WaitQ with head of queue task id {}"
                                + "....Current used capacity {}, and remaining capacity is {}",
                        task.getTaskId(), totalUsedCapacityBefore,
                        capacityRemain);
                // condition to add to the in progress map
                if (totalUsedCapacityNew <= ParallecGlobalConfig.maxCapacity) {
                    logger.info(
                            "TASK_WAIT_Q: Sufficent capacity. Execute new task from wait queue. Task capacity {}"
                                    + " with total used capacity is now {}, capacityRemain will be {}",
                            capacityThisTask, totalUsedCapacityNew,
                            ParallecGlobalConfig.maxCapacity
                                    - totalUsedCapacityNew);

                    waitQ.poll(); // dequeue
                    Runnable taskRunnable = new Runnable() {
                        @Override
                        public void run() {
                            ParallelTaskManager.getInstance()
                                    .generateUpdateExecuteTask(task);
                        }
                    };
                    new Thread(taskRunnable).start();
                } else {
                    logger.info(
                            "TASK_WAIT_Q: Skip execution new task. Insufficent capacity. "
                                    + "Head of queue task needs capacity {}. However capacityRemain is only {}.",
                            capacityThisTask, capacityRemain);
                }

            }

        } catch (Exception e) {
            logger.error("TASK_WAIT_Q: fail in EvalTaskInWaitQRunner ", e);
        }
    }
259004
def _has_no_pendings(self, statuses):
        
        return all(s != ClientBatchStatus.PENDING for s in statuses.values())
335652
private synchronized void maybeRun() {
        if (inprogress==null && pending!=null) {
            base.submit(new Callable<Void>() {
                @Override
                public Void call() throws Exception {
                    synchronized (AtmostOneTaskExecutor.this) {
                        // everyone who submits after this should form a next batch
                        inprogress = pending;
                        pending = null;
                    }

                    try {
                        inprogress.set(task.call());
                    } catch (Throwable t) {
                        LOGGER.log(Level.WARNING, null, t);
                        inprogress.setException(t);
                    } finally {
                        synchronized (AtmostOneTaskExecutor.this) {
                            // if next one is pending, get that scheduled
                            inprogress = null;
                            maybeRun();
                        }
                    }
                    return null;
                }
            });
        }
    }
1140490
protected final boolean runAllTasksFrom(Queue<Runnable> taskQueue) {
        Runnable task = pollTaskFrom(taskQueue);
        if (task == null) {
            return false;
        }
        for (;;) {
            safeExecute(task);
            task = pollTaskFrom(taskQueue);
            if (task == null) {
                return true;
            }
        }
    }
1122358
def create_pending_after_task(self):
        
        for task in self.settings.tasks[self.after_tasks_key]:
            self.after_tasks.append(task)
            self.after_results[task] = Result(task)
77688
def Run(self, request):
    """"""

    self.request = request
    filters = self.BuildChecks(request)

    files_checked = 0
    for f in self.ListDirectory(request.pathspec):
      self.Progress()

      # Ignore this file if any of the checks fail.
      if not any((check(f) for check in filters)):
        self.SendReply(f)

      files_checked += 1
      if files_checked >= self.MAX_FILES_TO_CHECK:
        return
285480
def check_status(self):
        """"""
        # Recompute the status of the tasks
        # Ignore OK and LOCKED tasks.
        for task in self:
            if task.status in (task.S_OK, task.S_LOCKED): continue
            task.check_status()

        # Take into account possible dependencies. Use a list instead of generators
        for task in self:
            if task.status == task.S_LOCKED: continue
            if task.status < task.S_SUB and all(status == task.S_OK for status in task.deps_status):
                task.set_status(task.S_READY, "Status set to Ready")
748043
function queue(runner) {
    if (running < tasks) {
      ++running;
      runner(release);
    } else {
      pending.push(runner);
    }
  }
279519
public static function run_all_adhoc_tasks() {
        $now = time();
        while (($task = \core\task\manager::get_next_adhoc_task($now)) !== null) {
            try {
                $task->execute();
                \core\task\manager::adhoc_task_complete($task);
            } catch (Exception $e) {
                \core\task\manager::adhoc_task_failed($task);
            }
        }
    }