def get_queue_tasks() -> Sequence[Tuple[Task, Sequence[str]]]: results = [] for task in Task.search_states(states=TaskState.available()): containers = get_input_container_queues(task.config) if containers: results.append((task, containers)) return results
def get_tasks_by_pool_name(cls, pool_name: str) -> List["Task"]: tasks = cls.search_states(states=TaskState.available()) if not tasks: return [] pool_tasks = [] for task in tasks: task_pool = task.get_pool() if not task_pool: continue if pool_name == task_pool.name: pool_tasks.append(task) return pool_tasks
def search_expired(cls) -> List["Task"]: time_filter = "end_time lt datetime'%s'" % datetime.utcnow().isoformat( ) return cls.search(query={"state": TaskState.available()}, raw_unchecked_filter=time_filter)