swh.scheduler.utils module

swh.scheduler.utils.get_task(task_name)[source]

Retrieve task object in our application instance by its fully qualified python name.

Parameters

task_name (str) – task’s name (e.g swh.loader.git.tasks.LoadDiskGitRepository)

Returns

Instance of task

swh.scheduler.utils.create_task_dict(type, policy, *args, **kwargs)[source]
Create a task with type and policy, scheduled for as soon as

possible.

Parameters
  • type (str) – Type of oneshot task as per swh-scheduler’s db table task_type’s column (Ex: load-git, check-deposit)

  • policy (str) – oneshot or recurring policy

Returns

Expected dictionary for the one-shot task scheduling api (swh.scheduler.backend.create_tasks)

swh.scheduler.utils.create_oneshot_task_dict(type, *args, **kwargs)[source]

Create a oneshot task scheduled for as soon as possible.

Parameters

type (str) – Type of oneshot task as per swh-scheduler’s db table task_type’s column (Ex: load-git, check-deposit)

Returns

Expected dictionary for the one-shot task scheduling api (swh.scheduler.backend.create_tasks)