swh.scheduler.in_memory module#

class swh.scheduler.in_memory.InMemoryScheduler[source]#

Bases: object

create_task_type(task_type: TaskType) None[source]#
get_task_type(task_type_name: str) TaskType | None[source]#
get_task_types() List[TaskType][source]#
get_listers(with_first_visits_to_schedule: bool = False) List[Lister][source]#

Retrieve information about all listers from the database.

get_listers_by_id(lister_ids: List[str]) List[Lister][source]#
get_lister(name: str, instance_name: str | None = None) Lister | None[source]#
get_or_create_lister(name: str, instance_name: str | None = None, first_visits_queue_prefix: str | None = None) Lister[source]#
update_lister(lister: Lister) Lister[source]#
record_listed_origins(listed_origins: Iterable[ListedOrigin]) List[ListedOrigin][source]#
get_listed_origins(lister_id: UUID | None = None, url: str | None = None, urls: List[str] | None = None, enabled: bool | None = True, limit: int = 1000, page_token: Tuple[str, str] | None = None) PaginatedListedOriginList[source]#
get_visit_types_for_listed_origins(lister: Lister) List[str][source]#
grab_next_visits(visit_type: str, count: int, policy: str, enabled: bool = True, lister_uuid: str | None = None, lister_name: str | None = None, lister_instance_name: str | None = None, timestamp: datetime | None = None, absolute_cooldown: timedelta | None = datetime.timedelta(seconds=43200), scheduled_cooldown: timedelta | None = datetime.timedelta(days=7), failed_cooldown: timedelta | None = datetime.timedelta(days=14), not_found_cooldown: timedelta | None = datetime.timedelta(days=31), tablesample: float | None = None) List[ListedOrigin][source]#
create_tasks(tasks: List[Task], policy: Literal['recurring', 'oneshot'] = 'recurring') List[Task][source]#
set_status_tasks(task_ids: List[int], status: Literal['next_run_not_scheduled', 'next_run_scheduled', 'completed', 'disabled'] = 'disabled', next_run: datetime | None = None) None[source]#
disable_tasks(task_ids: List[int]) None[source]#
search_tasks(task_id: int | None = None, task_type: str | None = None, status: Literal['next_run_not_scheduled', 'next_run_scheduled', 'completed', 'disabled'] | None = None, priority: Literal['high', 'normal', 'low'] | None = None, policy: Literal['recurring', 'oneshot'] | None = None, before: datetime | None = None, after: datetime | None = None, limit: int | None = None) List[Task][source]#
get_tasks(task_ids: List[int]) List[Task][source]#
peek_ready_tasks(task_type: str, timestamp: datetime | None = None, num_tasks: int | None = None) List[Task][source]#
grab_ready_tasks(task_type: str, timestamp: datetime | None = None, num_tasks: int | None = None) List[Task][source]#
peek_ready_priority_tasks(task_type: str, timestamp: datetime | None = None, num_tasks: int | None = None) List[Task][source]#
grab_ready_priority_tasks(task_type: str, timestamp: datetime | None = None, num_tasks: int | None = None) List[Task][source]#
schedule_task_run(task_id: int, backend_id: str, metadata: Dict[str, Any] | None = None, timestamp: datetime | None = None) TaskRun[source]#
mass_schedule_task_runs(task_runs: List[TaskRun]) None[source]#
start_task_run(backend_id: str, metadata: Dict[str, Any] | None = None, timestamp: datetime | None = None) TaskRun | None[source]#
end_task_run(backend_id: str, status: Literal['scheduled', 'started', 'eventful', 'uneventful', 'failed', 'permfailed', 'lost'], metadata: Dict[str, Any] | None = None, timestamp: datetime | None = None) TaskRun | None[source]#
filter_task_to_archive(after_ts: str, before_ts: str, limit: int = 10, page_token: str | None = None) Dict[str, Any][source]#
delete_archived_tasks(task_ids)[source]#
get_task_runs(task_ids: List[int], limit: int | None = None) List[TaskRun][source]#
origin_visit_stats_upsert(origin_visit_stats: Iterable[OriginVisitStats]) None[source]#
origin_visit_stats_get(ids: Iterable[Tuple[str, str]]) List[OriginVisitStats][source]#
visit_scheduler_queue_position_get() Dict[str, int][source]#
visit_scheduler_queue_position_set(visit_type: str, position: int) None[source]#
update_metrics(lister_id: UUID | None = None, timestamp: datetime | None = None) List[SchedulerMetrics][source]#
get_metrics(lister_id: UUID | None = None, visit_type: str | None = None) List[SchedulerMetrics][source]#