Cancel all remaining tasks.
552291
async def cancel_remaining(self):
        ''''''
        self._closed = True
        task_list = list(self._pending)
        for task in task_list:
            task.cancel()
        for task in task_list:
            with suppress(CancelledError):
                await task
751964
def purge(self):
    """"""
    try:
      return self._api.purge()
    except AttributeError:
      while True:
        lst = self.list()
        if len(lst) == 0:
          break

        for task in lst:
          self.delete(task)
        self.wait()
      return self
398791
async def _clean_shutdown(self):
        """"""

        # Cleanly stop any other outstanding tasks not associated with tiles
        remaining_tasks = []
        for task in self._tasks.get(None, []):
            self._logger.debug("Cancelling task at shutdown %s", task)
            task.cancel()

            remaining_tasks.append(task)

        asyncio.gather(*remaining_tasks, return_exceptions=True)

        if len(remaining_tasks) > 0:
            del self._tasks[None]

        # Shutdown tasks associated with each tile
        remaining_tasks = []

        for address in sorted(self._tasks, reverse=True):
            if address is None:
                continue

            self._logger.debug("Shutting down tasks for tile at %d", address)
            for task in self._tasks.get(address, []):
                task.cancel()
                remaining_tasks.append(task)

        asyncio.gather(*remaining_tasks, return_exceptions=True)

        await self._rpc_queue.stop()

        self._loop.stop()
125294
def do_shutdown (self):
        """"""
        with self.mutex:
            unfinished = self.unfinished_tasks - len(self.queue)
            self.queue.clear()
            if unfinished <= 0:
                if unfinished < 0:
                    raise ValueError('shutdown is in error')
                self.all_tasks_done.notifyAll()
            self.unfinished_tasks = unfinished
            self.shutdown = True
681897
def delete_tasks(config, task_id):
    """"""
    if task_id is None:
        msg = ("Are you sure you want to delete all the tasks and associated task runs?")
        if click.confirm(msg):
            res = _delete_tasks(config, task_id)
            click.echo(res)

        else:
            click.echo("Aborting.")
    else:
        res = _delete_tasks(config, task_id)
        click.echo(res)
705057
def cancel(self):
        """"""
        if self.status > COMPLETED:
            return
        cmd = self.backend.cmd_cancel(self)
        self._run_cmd(cmd, self.remote, ignore_exit_code=True, ssh=self.ssh)
        self._status = CANCELLED
        self.dump()
177210
def cancel(self, method):
        """"""
        if method in self._scheduledMethods:
            self._scheduledMethods.remove(method)

        if not self._scheduledMethods:
            self._timer.stop()
1278926
def stop(self):
        """"""
        if self.running and self.num_workers:
            for worker in self.workers:
                self.queue.put(None)
            for worker in self.workers:
                worker.join()
            # Free up references held by workers
            del self.workers[:]
            self.queue.join()
        self.running = False
1254207
function abort(state)
{
  Object.keys(state.jobs).forEach(clean.bind(state));

  // reset leftover jobs
  state.jobs = {};
}
1225044
public void cancel() {
        if(actionInBackground != null) {
            if(executorService != null) {
               asyncFutureTask.cancel(true);
            } else {
                asyncThread.interrupt();
            }
        }
    }
705652
def _clear_queue(to_clear):
    """"""

    while not to_clear.empty():
        try:
            to_clear.get(False)
            to_clear.task_done()
        except queue.Empty:
            continue
767509
def cancel(self):
        """"""
        if self in scoop._control.execQueue.movable:
            self.exceptionValue = CancelledError()
            scoop._control.futureDict[self.id]._delete()
            scoop._control.execQueue.remove(self)
            return True
        return False
946103
def stop(self):
        

        self._clean_prior()

        if not self._loaded:
            raise errors.NoActiveTask

        self._clean()
598584
async def shutdown(sig, loop):
    """"""
    logging.info(f'Received exit signal {sig.name}...')
    tasks = [task for task in asyncio.Task.all_tasks() if task is not
             asyncio.tasks.Task.current_task()]

    for task in tasks:
        logging.debug(f'Cancelling task: {task}')
        task.cancel()

    results = await asyncio.gather(*tasks, return_exceptions=True)
    logging.debug(f'Done awaiting cancelled tasks, results: {results}')

    loop.stop()
    logging.info('Shutdown complete.')
812645
def close(self):
        """"""
        self._closed = True
        if self.receive_task:
            self.receive_task.cancel()
        if self.connection:
            self.connection.close()
54824
def terminate(self):
        """"""
        for t in self._threads:
            t.quit()
        self._thread = []
        self._workers = []
51765
public void cancelAllJobs(){
        Iterator<CacheManagerTask> iterator = mPendingTasks.iterator();
        while (iterator.hasNext()) {
            CacheManagerTask next = iterator.next();
            next.cancel(true);
        }
        mPendingTasks.clear();
    }