Return a SetupTask, if appropriate, to run on the given tasktracker
433526
public Task obtainJobSetupTask(
      String taskTrackerName, String hostName, boolean isMapSlot) {
    synchronized (lockObject) {
      if (!tasksInited || !jobSetupCleanupNeeded) {
        return null;
      }

      if (!(tasksInited && status.getRunState() == JobStatus.PREP &&
           !launchedSetup && !jobKilled && !jobFailed)) {
        return null;
      }
      List<TaskInProgress> setupTaskList = new ArrayList<TaskInProgress>();
      if (isMapSlot) {
        setupTaskList.add(setup[0]);
      } else {
        setupTaskList.add(setup[1]);
      }
      TaskInProgress tip = findTaskFromList(setupTaskList, hostName, false);
      if (tip == null) {
        return null;
      }

      // Now launch the setupTask
      Task result = tip.getTaskToRun(taskTrackerName);
      if (result != null) {
        addRunningTaskToTIPUnprotected(tip, result.getTaskID(), taskTrackerName, hostName,
            true);
      }
      return result;
    }
  }
1230890
def get_task(self, task_id):
        
        task = self.request_single('GetTask', {'id': task_id})

        if task:
            return zobjects.Task.from_dict(task)
        else:
            return None
1315854
def _taskify(func):
	''''''
	if not isinstance(func, _Task):
		func = _Task(func)

		spec = inspect.getargspec(func.func)
		if spec.args:
			num_args = len(spec.args)
			num_kwargs = len(spec.defaults or [])
			isflag = lambda x, y: '' if x.defaults[y] is False else '='

			func.args = spec.args[:(num_args - num_kwargs)]
			func.defaults = {spec.args[i - num_kwargs]: spec.defaults[i] for i in range(num_kwargs)}
			func.kwargs = [key.replace('_','-') + isflag(func, key) for key in func.defaults]

		if not func.name.startswith('_'):
			TASKS.append(func)

	return func
339863
@Override
	public TaskBase getTask(DeferredEvent deferredEvent) {
		return getTask(deferredEvent.getProcessDefinitionName(),deferredEvent.getTaskId());
	}
478303
def getTaskHelp(_Task):
  
  """
  Ret = []

  for k in ['name', 'desc']:
    v = _Task.Config.get(k)

    if v is not None:
      Ret.append('%s: %s' % (k, v))

  Args = _Task.Args

  if Args:
    Ret.append('\nArgs:')

    for argName, Arg in Args.items():
      Ret.append('  %s: %s' % (argName, Arg.get('desc', Arg['type_str'])))

    Ret.append('')

  return '\n'.join(Ret).rstrip()
849861
def get_tasklogger(name="TaskLogger"):
    
    try:
        return logging.getLogger(name).tasklogger
    except AttributeError:
        return logger.TaskLogger(name)
818362
def _setup_task(self, load):
        

        if not self._task:
            self._task = Task(self._data_dir)

        if load:
            self._task.load()
1238005
function Task(options) {
  if (!(this instanceof Task)) {
    return new Task(options);
  }

  utils.is(this, 'task');
  use(this);

  this.options = options || {};
  if (utils.isTask(options)) {
    this.options = {};
    this.addTargets(options);
    return this;
  }
}
984611
function taskFileMain(argv)
{
    if( argv === undefined ) argv = process.argv

    const [options, args, helpText] = CLI.taskFileParse(argv);
    const collection = getTasksFromTaskfile();

    const p = loadPackageJson();
    if( tryShowVersion(options, p.version) )
        return;
    if( tryShowTasks(options, collection) )
        return;
    if( tryShowHelp(options, helpText) )
        return;

    tryRunTask(args, collection);
}
1307130
def get_task(client, task_id):
    '''  '''
    endpoint = '/'.join([client.api.Endpoints.TASKS, str(task_id)])
    response = client.authenticated_request(endpoint)
    return response.json()
122635
def task(name=None, t=INFO, *args, **kwargs):
    

    def c_run(name, f, t, args, kwargs):
        def run(*largs, **lkwargs):
            thread = __get_current_thread()
            old_name = __THREAD_PARAMS[thread][__THREAD_PARAMS_FNAME_KEY]
            __THREAD_PARAMS[thread][__THREAD_PARAMS_FNAME_KEY] = name

            r = log(name, f, t, largs, lkwargs, *args, **kwargs)

            __THREAD_PARAMS[thread][__THREAD_PARAMS_FNAME_KEY] = old_name
            return r

        return run

    if callable(name):
        f = name
        name = f.__name__

        return c_run(name, f, t, args, kwargs)

    if name == None:
        def wrapped(f):
            name = f.__name__
            return c_run(name, f, t, args, kwargs)

        return wrapped
    else:
        return lambda f: c_run(name, f, t, args, kwargs)
36614
def run_task(func):
    

    def _wrapped(*a, **k):
        gen = func(*a, **k)
        return _consume_task(gen)

    return _wrapped
1052085
def synctasklet(func):
  
  taskletfunc = tasklet(func)  # wrap at declaration time.

  @utils.wrapping(func)
  def synctasklet_wrapper(*args, **kwds):
    # pylint: disable=invalid-name
    __ndb_debug__ = utils.func_info(func)
    return taskletfunc(*args, **kwds).get_result()
  return synctasklet_wrapper
381263
async def run_gen_task(self, container, gentask, newthread = True):
        ""
        e = TaskEvent(self, gen_task = gentask, newthread = newthread)
        await container.wait_for_send(e)
        ev = await TaskDoneEvent.createMatcher(e)
        if hasattr(ev, 'exception'):
            raise ev.exception
        else:
            return ev.result
776934
def register_ddk_task(self, *args, **kwargs):
        """"""
        kwargs["task_class"] = DdkTask
        return self.register_task(*args, **kwargs)
274269
@Override
	public void setup(PactTaskContext<GenericCoGrouper<IT1, IT2, OT>, OT> context) {
		this.taskContext = context;
		this.running = true;
	}
1117259
def import_and_get_task(task_path):
    
    module, function = task_path.rsplit('.', 1)
    app_module = importlib.import_module(module)
    app_function = getattr(app_module, function)
    return app_function