Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/interface.py
# Copyright (C) 2015-2020 The Software Heritage developers | # Copyright (C) 2015-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from typing import Any, Dict, Iterable, List, Optional | from typing import Any, Dict, Iterable, List, Optional | ||||
from uuid import UUID | from uuid import UUID | ||||
from typing_extensions import Protocol, runtime_checkable | |||||
from swh.core.api import remote_api_endpoint | from swh.core.api import remote_api_endpoint | ||||
from swh.scheduler.model import ( | from swh.scheduler.model import ( | ||||
ListedOrigin, | ListedOrigin, | ||||
ListedOriginPageToken, | ListedOriginPageToken, | ||||
Lister, | Lister, | ||||
PaginatedListedOriginList, | PaginatedListedOriginList, | ||||
) | ) | ||||
class SchedulerInterface: | @runtime_checkable | ||||
class SchedulerInterface(Protocol): | |||||
@remote_api_endpoint("task_type/create") | @remote_api_endpoint("task_type/create") | ||||
def create_task_type(self, task_type): | def create_task_type(self, task_type): | ||||
"""Create a new task type ready for scheduling. | """Create a new task type ready for scheduling. | ||||
Args: | Args: | ||||
task_type (dict): a dictionary with the following keys: | task_type (dict): a dictionary with the following keys: | ||||
- type (str): an identifier for the task type | - type (str): an identifier for the task type | ||||
▲ Show 20 Lines • Show All 285 Lines • Show Last 20 Lines |