Get all the tasks that match a name
540617
def tasks(self, name):
        ''''''
        found = self[name]
        if isinstance(found, Shovel):
            return [v for _, v in found.items()]
        return [found]
798970
def get_active_tasks(self):
        """"""
        current_tasks = self.celery.control.inspect().active() or dict()
        return [
            task.get('id') for host in current_tasks.values() for task in host]
654052
def find_all_by_parameters(self, task_name, session=None, **task_params):
        
        with self._session(session) as session:
            query = session.query(TaskRecord).join(TaskEvent).filter(TaskRecord.name == task_name)
            for (k, v) in six.iteritems(task_params):
                alias = sqlalchemy.orm.aliased(TaskParameter)
                query = query.join(alias).filter(alias.name == k, alias.value == v)

            tasks = query.order_by(TaskEvent.ts)
            for task in tasks:
                # Sanity check
                assert all(k in task.parameters and v == str(task.parameters[k].value) for (k, v) in six.iteritems(task_params))

                yield task
80923
def collection_names(self, _deadline=None):
        """"""
        def ok(results):
            names = [r["name"] for r in results]
            names = [n[len(str(self)) + 1:] for n in names
                     if n.startswith(str(self) + ".")]
            names = [n for n in names if "$" not in n]
            return names
        return self["system.namespaces"].find(_deadline=_deadline).addCallback(ok)
1183249
def filter_tasks(self, task_names, keep_dependencies=False):
        """"""
        new_tasks = {}
        for task_name in task_names:
            task = self.get_task(task_name)
            if task not in new_tasks:
                new_tasks[task.name] = task
            if keep_dependencies:
                for dependency in task.ordered_dependencies():
                    if dependency not in new_tasks:
                        new_tasks[dependency.name] = dependency
            else:
                #strip dependencies
                task.dependencies = set()

        self.tasks = new_tasks
72225
def get_smart_tasks(self):
        
        def process_result(result):
            return [self.get_smart_task(task) for task in result]

        return Command('get', [ROOT_SMART_TASKS],
                       process_result=process_result)
675687
function getTask(name) {
  if (!this.tasks[name]) {
    log.error(new Error('Task "' + name + '" is not registered.'));
    return null;
  }
  return this.tasks[name];
}
1019490
def list_tasks(collector):
    """"""
    print("Usage: dashmat <task>")
    print("")
    print("Available tasks to choose from are:")
    print("-----------------------------------")
    print("")
    keygetter = lambda item: item[1].label
    tasks = sorted(available_actions.items(), key=keygetter)
    sorted_tasks = sorted(list(tasks), key=lambda item: len(item[0]))
    max_length = max(len(name) for name, _ in sorted_tasks)
    for key, task in sorted_tasks:
        desc = dedent(task.__doc__ or "").strip().split('\n')[0]
        print("\t{0}{1} :-: {2}".format(" " * (max_length-len(key)), key, desc))
    print("")
459581
function getAllTasks(directories, options) {
	const allTasks = getAllAliases(options);
	for (const dir of directories) {
		const tasks = glob.sync(`${dir}/*/index.js`);
		tasks.forEach(filename => {
			const taskName = path.basename(path.dirname(filename));
			if (!allTasks[taskName]) {
				const module = require(filename);
				allTasks[taskName] = module.description || '';
			}
		});
	}
	return allTasks;
}
97966
def find_tasks(source_code):
    """"""
    results = []
    for line, text in enumerate(source_code.splitlines()):
        for todo in re.findall(TASKS_PATTERN, text):
            todo_text = (todo[-1].strip(' :').capitalize() if todo[-1]
                         else todo[-2])
            results.append((todo_text, line + 1))
    return results
1093635
def lookup_in_scope(name, scope)
      loop do
        tn = scope.path_with_task_name(name)
        task = @tasks[tn]
        return task if task
        break if scope.empty?
        scope = scope.tail
      end
      nil
    end
417565
def tasks(self):
        """"""
        return [StartActionItem(
            self._task,
            i,
            self.state,
            self.path,
            self.raw) for i in range(len(self.raw))]
939514
function filterTasks (type, tasks, alltasks) {
    var contains = function (task) {
        return _.includes(tasks, task.name);
    };

    if (type === 'include') {
        return _.filter(alltasks, contains);
    } else if (type === 'exclude') {
        return _.reject(alltasks, contains);
    }
    return alltasks;
}
934692
def items(self):
        
        return {dep.task: value for dep, value in self._result.items()}.items()
730512
def get_tasks(self):
        
        tasks = collections.OrderedDict()
        for dep in self.ordered_dependencies:
            tasks[dep.name] = dep.task

        return tasks
972369
def list_tasks(collector, tasks, **kwargs):
    """"""
    print("Available tasks to choose from are:")
    print("Use the --task option to choose one")
    print("")
    keygetter = lambda item: item[1].label
    tasks = sorted(tasks.items(), key=keygetter)
    for label, items in itertools.groupby(tasks, keygetter):
        print("--- {0}".format(label))
        print("----{0}".format("-" * len(label)))
        sorted_tasks = sorted(list(items), key=lambda item: len(item[0]))
        max_length = max(len(name) for name, _ in sorted_tasks)
        for key, task in sorted_tasks:
            desc = dedent(task.description or "").strip().split('\n')[0]
            print("\t{0}{1} :-: {2}".format(" " * (max_length-len(key)), key, desc))
        print("")
201498
def get_task(self, name, include_helpers=True):
        

        if not include_helpers and name in self._helper_names:
            raise TaskNotFound(name)
        try:
            return getattr(self._tasks, name)
        except AttributeError:
            raise TaskNotFound(name)