create task and immediately execute it (will wait until execution finish)
555338
public Long createAndExecuteTask(String taskName, String data, String key1, String key2) {
		return tedDriverImpl.createAndExecuteTask(taskName, data, key1, key2, false);
	}
491824
public synchronized void executeTask(long jobId, int taskId, JobConfig jobConfig,
      Serializable taskArgs, RunTaskContext context) {
    Future<?> future = mTaskExecutionService
        .submit(new TaskExecutor(jobId, taskId, jobConfig, taskArgs, context, this));
    Pair<Long, Integer> id = new Pair<>(jobId, taskId);
    mTaskFutures.put(id, future);
    TaskInfo.Builder taskInfo = TaskInfo.newBuilder();
    taskInfo.setJobId(jobId);
    taskInfo.setTaskId(taskId);
    taskInfo.setStatus(Status.RUNNING);
    mUnfinishedTasks.put(id, taskInfo);
    mTaskUpdates.put(id, taskInfo.build());
    LOG.info("Task {} for job {} started", taskId, jobId);
  }
1174548
async def _wait_execute(self, address, command, args, kw):
        """"""
        conn = await self.acquire(command, args)
        try:
            return (await conn.execute(command, *args, **kw))
        finally:
            self.release(conn)
1370304
def start_task(self, method, *args, **kwargs):
        
        thread = threading.Thread(target=method, args=args, kwargs=kwargs)
        thread.is_daemon = False
        thread.start()
        self.threads.append(thread)
157409
def wait_for_task(task_data, task_uri='/tasks'):
    
    taskid = post_task(task_data, task_uri)

    if isinstance(task_data, str):
        json_data = json.loads(task_data)
    else:
        json_data = task_data

    # inspect the task to see if a timeout is configured
    job = json_data['job'][0]
    env = job.get('credentials')
    task_type = job.get('type')

    timeout = TASK_TIMEOUTS.get(env, dict()).get(task_type, DEFAULT_TASK_TIMEOUT)

    LOG.debug("Task %s will timeout after %s", task_type, timeout)

    return check_task(taskid, timeout)
825204
def main(args):
	''''''
	if SETUP:
		args = _invoke(SETUP, args)

	if not args and DEFAULT:
		DEFAULT()
	else:
		while args:
			task = _get_task(args[0])
			if task is None:
				abort(LOCALE['error_no_task'], args[0])

			args = _invoke(task, args[1:])

	if TEARDOWN:
		TEARDOWN()
534325
function createNewTask(task) {
        console.log("Creating task...");

        //set up the new list item
        const listItem = document.createElement("li");
        const checkBox = document.createElement("input");
        const label = document.createElement("label");


        //pull the inputed text into label
        label.innerText = task;

        //add properties
        checkBox.type = "checkbox";

        //add items to the li
        listItem.appendChild(checkBox);
        listItem.appendChild(label);
        //everything put together
        return listItem;
    }
321909
def main(self):
        """"""

        self._setup_task_manager()
        self._setup_source_and_destination()
        self.task_manager.blocking_start(waiting_func=self.waiting_func)
        self.close()
        self.config.logger.info('done.')
57766
def execute(self):
        

        with self._lock_c:
            self.count = 0
            self.numtasks = 0
            self.taskset = []
            self.results = {}
            self.totaltime = time.time()
            # Start all tasks
            for task in self.taskseq:
                self.taskset.append(task)
                self.numtasks += 1
                task.init_and_start(self)

        num_tasks = self.getNumTasks()
        # Wait on each task to clean up results
        while num_tasks > 0:

            self.check_state()

            for i in range(num_tasks):
                try:
                    try:
                        task = self.getTask(i)
                    except IndexError:
                        # A task got deleted from the set.  Jump back out
                        # to outer loop and repoll the number of tasks
                        break

                    #self.logger.debug("waiting on %s" % task)
                    res = task.wait(timeout=self.idletime)

                    #self.logger.debug("finished: %s" % task)
                    self.child_done(res, task)

                except TaskTimeout:
                    continue

                except Exception as e:
                    #self.logger.warning("Subtask propagated exception: %s" % str(e))
                    self.child_done(e, task)
                    continue

            # wait a bit and try again
            #self.ev_quit.wait(self.idletime)

            # re-get number of tasks, in case some were added or deleted
            num_tasks = self.getNumTasks()

        # Scan results for errors (exceptions) and raise the first one we find
        for key in self.results.keys():
            value = self.results[key]
            if isinstance(value, Exception):
                (count, task) = key
                self.logger.error("Child task %s terminated with exception: %s" % (
                    task.tag, str(value)))
                raise value

        # Return value of last child to complete
        return value
683555
def task_wait(meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code):
    
    task_wait_with_io(
        meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code
    )
437075
def sync_fetch(self, task):
        ''''''
        if not self._running:
            return self.ioloop.run_sync(functools.partial(self.async_fetch, task, lambda t, _, r: True))

        wait_result = threading.Condition()
        _result = {}

        def callback(type, task, result):
            wait_result.acquire()
            _result['type'] = type
            _result['task'] = task
            _result['result'] = result
            wait_result.notify()
            wait_result.release()

        wait_result.acquire()
        self.ioloop.add_callback(self.fetch, task, callback)
        while 'result' not in _result:
            wait_result.wait()
        wait_result.release()
        return _result['result']
1255500
function(task) {
  task.error = false;
  task.state = sStateTable[task.state][START];
  setTimeout(function() {
    if(task.state === RUNNING) {
      task.swapTime = +new Date();
      task.run(task);
      runNext(task, 0);
    }
  }, 0);
}
1350333
def execute(self):
        
        self.count = 0
        self.taskset = []
        self.results = {}
        self.totaltime = time.time()

        # Register termination callbacks for all my child tasks.
        for task in list(self.taskseq):
            self.taskset.append(task)
            task.add_callback('resolved', self.child_done, self.count)
            self.count += 1

        self.numtasks = self.count

        # Now start each child task.
        with self.regcond:
            for task in list(self.taskset):
                task.initialize(self)

                task.start()

            # Account for time needed to start subtasks
            self.totaltime = time.time() - self.totaltime

            # Now give up the critical section and wait for last child
            # task to terminate.
            while self.count > 0:
                self.regcond.wait()

        # Scan results for errors (exceptions) and raise the first one we find
        for key in self.results.keys():
            value = self.results[key]
            if isinstance(value, Exception):
                (count, task) = key
                self.logger.error("Child task %s terminated with exception: %s" % (
                    task.tag, str(value)))
                raise value

        return 0
564214
def _insert_post_complete_tasks(context):
    """"""

    logging.debug("Context %s is complete.", context.id)

    # Async event handlers
    context.exec_event_handler('complete', transactional=True)

    # Insert cleanup tasks
    try:
        # TODO: If tracking results we may not want to auto cleanup and instead
        # wait until the results have been accessed.
        from furious.async import Async
        Async(_cleanup_markers, queue=CLEAN_QUEUE,
              args=[context.id, context.task_ids],
              task_args={'countdown': CLEAN_DELAY}).start()
    except:
        pass
344777
async def run_task(self, container, task, newthread = False):
        ""
        e = TaskEvent(self, task=task, newthread = newthread)
        await container.wait_for_send(e)
        ev = await TaskDoneEvent.createMatcher(e)
        if hasattr(ev, 'exception'):
            raise ev.exception
        else:
            return ev.result
877386
def execute_with_delay(task_function, *args, **kwargs):
    
    delay = kwargs.pop('delay', 0)
    if get_setting('TEST_DISABLE_ASYNC_DELAY'):
        # Delay disabled, run synchronously
        logger.debug('Running function "%s" synchronously because '\
                     'TEST_DISABLE_ASYNC_DELAY is True'
                     % task_function.__name__)
        return task_function(*args, **kwargs)

    db.connections.close_all()
    task_function.apply_async(args=args, kwargs=kwargs, countdown=delay)
496384
public void execute(final FifoTask<E> task) throws InterruptedException {
        final int id;
        synchronized (this) {
            id = idCounter++;
            taskMap.put(id, task);
            while (activeCounter >= maxThreads) {
                wait();
            }
            activeCounter++;
        }

        this.threadPoolExecutor.execute(new Runnable() {
            public void run() {
                try {
                    try {
                        final E outcome = task.runParallel();
                        synchronized (resultMap) {
                            resultMap.put(id, new Result(outcome));
                        }
                    } catch (Throwable th) {
                        synchronized (resultMap) {
                            resultMap.put(id, new Result(null, th));
                        }
                    } finally {
                        processResults();
                        synchronized (FifoTaskExecutor.this) {
                            activeCounter--;
                            FifoTaskExecutor.this.notifyAll();
                        }
                    }
                } catch (Exception ex) {
                    Logger.getLogger(FifoTaskExecutor.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                }
            }
        });
    }