Blocking method which wait end of task.
        It's prefered to use :class:`carotte.Task` object directly

        :param string task_id: Task ID

        :returns: Task dict
        :rtype: dict
329157
def wait(self, task_id):
        
        data = {
            'action': 'wait',
            'id': task_id
        }
        self.__send_pyobj(data)
        task = self.__recv_pyobj(notimeout=True)
        return task
357570
def wait_stop(self):
        
        if not self.running:
            return
        self.stop()
        try:
            yield from self._task
        except asyncio.CancelledError:
            pass
679039
def get_tasks(self, list_id, completed=False):
        '''  '''
        return tasks_endpoint.get_tasks(self, list_id, completed=completed)
1130016
def check_for_stalled_tasks():
    
    from api.models.tasks import Task
    for task in Task.objects.filter(status_is_running=True):
        if not task.is_responsive():
            task.system_error()
        if task.is_timed_out():
            task.timeout_error()
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)
964545
def wait_all_tasks_done(self, timeout=None, delay=0.5, interval=0.1):
        """"""
        timeout = self._timeout if timeout is None else timeout
        timeout = timeout or float("inf")
        start_time = time.time()
        time.sleep(delay)
        while 1:
            if not self.todo_tasks:
                return self.all_tasks
            if time.time() - start_time > timeout:
                return self.done_tasks
            time.sleep(interval)
65558
public static void waitOneFinished(List<? extends Task<?,?>> tasks) {
		if (tasks.isEmpty()) return;
		if (tasks.size() == 1)
			try { tasks.get(0).getOutput().block(0); }
			catch (Throwable e) { /* ignore */ }
		SynchronizationPoint<Exception> sp = new SynchronizationPoint<>();
		for (Task<?,?> t : tasks) {
			if (t.isDone()) return;
			t.getOutput().synchWithNoError(sp);
		}
		sp.block(0);
	}
1049063
def wait(self):
        
        if self.is_master():
            raise RuntimeError("Master node told to await jobs.")

        status = MPI.Status()

        while True:
            # Event loop.
            # Sit here and await instructions.
            if self.debug:
                print("Worker {0} waiting for task.".format(self.rank))

            # Blocking receive to wait for instructions.
            task = self.comm.recv(source=0, tag=MPI.ANY_TAG, status=status)

            if self.debug:
                print("Worker {0} got task {1} with tag {2}."
                      .format(self.rank, type(task), status.tag))

            # Check if message is special sentinel signaling end.
            # If so, stop.
            if isinstance(task, _close_pool_message):
                if self.debug:
                    print("Worker {0} told to quit.".format(self.rank))
                break

            # Check if message is special type containing new function
            # to be applied
            if isinstance(task, _function_wrapper):
                self.function = task.function
                if self.debug:
                    print("Worker {0} replaced its task function: {1}."
                          .format(self.rank, self.function))
                continue

            # If not a special message, just run the known function on
            # the input and return it asynchronously.
            result = self.function(task)
            if self.debug:
                print("Worker {0} sending answer {1} with tag {2}."
                      .format(self.rank, type(result), status.tag))
            self.comm.isend(result, dest=0, tag=status.tag)

        # Kill the process?
        if self.exit_on_end:
            sys.exit()
62531
def wait_until_state(task_id, state, max_nap)
      blink_time = 5 # wake up and scan
      nap_start = Time.now
      state_method = method("task_#{state}?".to_sym)
      loop do
        break if state_method.call(task_id)
        raise TaskNotDoneError, "Task: #{task_id} has taken too long to complete!" if Time.new > (nap_start + max_nap)

        sleep blink_time
      end
      task_id
    end
14693
def find_task_by_id(self, id, session=None):
        
        with self._session(session) as session:
            return session.query(TaskRecord).get(id)
1207621
public synchronized int cancelTask(final int taskId) throws UnsuccessfulException, NotFoundException {
    if (getTask(taskId, runningTasks) != null) {
      throw new UnsuccessfulException("The task " + taskId + " is running");
    } else if (getTask(taskId, finishedTasks) != null) {
      throw new UnsuccessfulException("The task " + taskId + " has finished");
    }

    final TaskEntity task = getTask(taskId, taskQueue);
    if (task == null) {
      final String message =
          new StringBuilder().append("Task with ID ").append(taskId).append(" is not found").toString();
      throw new NotFoundException(message);
    } else {
      taskQueue.remove(task);
      canceledTasks.add(task);
      return taskId;
    }
  }
1320420
def lookup_task(self, task):
        
        if isinstance(task, str):
            try:
                return self[task]
            except KeyError:
                pass
        raise TaskError('Unknown task %s' % task)
35138
def end_task(self):
        '''
        
        '''
        self.progress(self.task_stack[-1].size)
        self.task_stack.pop()
797303
async def inspect(self, task_id: str) -> Mapping[str, Any]:
        

        response = await self.docker._query_json(
            "tasks/{task_id}".format(task_id=task_id), method="GET"
        )
        return response
1082131
def cancel_download_task(self, task_id, expires=None, **kwargs):
        

        data = {
            'expires': expires,
            'task_id': task_id,
        }
        return self._request('services/cloud_dl', 'cancle_task',
                             data=data, **kwargs)
654543
def _canceling_task(self, backend):
        
        with self.backend_mutex:
            self.backends[backend] -= 1
            self.task_counter[backend] -= 1
847987
def task_log(self):
        
        if self.task_id is None:
            raise ValueError('task_id is None')
        return self.get_task_log(self.task_id, self.session, self.request_kwargs)