Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/utils.py
Show All 25 Lines | |||||
def create_task_dict(type, policy, *args, **kwargs): | def create_task_dict(type, policy, *args, **kwargs): | ||||
"""Create a task with type and policy, scheduled for as soon as | """Create a task with type and policy, scheduled for as soon as | ||||
possible. | possible. | ||||
Args: | Args: | ||||
type (str): Type of oneshot task as per swh-scheduler's db | type (str): Type of oneshot task as per swh-scheduler's db | ||||
table task_type's column (Ex: origin-update-git, | table task_type's column (Ex: load-git, | ||||
swh-deposit-archive-checks) | check-deposit) | ||||
policy (str): oneshot or recurring policy | policy (str): oneshot or recurring policy | ||||
Returns: | Returns: | ||||
Expected dictionary for the one-shot task scheduling api | Expected dictionary for the one-shot task scheduling api | ||||
(swh.scheduler.backend.create_tasks) | (swh.scheduler.backend.create_tasks) | ||||
""" | """ | ||||
task_extra = {} | task_extra = {} | ||||
Show All 15 Lines | def create_task_dict(type, policy, *args, **kwargs): | ||||
return task | return task | ||||
def create_oneshot_task_dict(type, *args, **kwargs): | def create_oneshot_task_dict(type, *args, **kwargs): | ||||
"""Create a oneshot task scheduled for as soon as possible. | """Create a oneshot task scheduled for as soon as possible. | ||||
Args: | Args: | ||||
type (str): Type of oneshot task as per swh-scheduler's db | type (str): Type of oneshot task as per swh-scheduler's db | ||||
table task_type's column (Ex: origin-update-git, | table task_type's column (Ex: load-git, | ||||
ardumont: `check-deposit` | |||||
swh-deposit-archive-checks) | check-deposit) | ||||
Returns: | Returns: | ||||
Expected dictionary for the one-shot task scheduling api | Expected dictionary for the one-shot task scheduling api | ||||
(swh.scheduler.backend.create_tasks) | (swh.scheduler.backend.create_tasks) | ||||
""" | """ | ||||
return create_task_dict(type, 'oneshot', *args, **kwargs) | return create_task_dict(type, 'oneshot', *args, **kwargs) |
check-deposit