worker_manager.py 992 Bytes
Newer Older
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3

4
from abc import ABC, abstractmethod
5
from typing import Any, Optional
6
7
8
9
10
11
12
13
14
15
16
17

import torch


class AbstractWorkerManager(ABC):

    def __init__(self, device: torch.device):
        self.device = device

    @property
    @abstractmethod
    def is_enabled(self) -> bool:
18
        raise NotImplementedError
19
20

    @abstractmethod
21
    def set_active_adapters(self, requests: set[Any],
22
                            mapping: Optional[Any]) -> None:
23
        raise NotImplementedError
24
25
26

    @abstractmethod
    def add_adapter(self, adapter_request: Any) -> bool:
27
        raise NotImplementedError
28
29
30

    @abstractmethod
    def remove_adapter(self, adapter_id: int) -> bool:
31
        raise NotImplementedError
32
33

    @abstractmethod
34
35
    def remove_all_adapters(self) -> None:
        raise NotImplementedError
36
37

    @abstractmethod
38
    def list_adapters(self) -> set[int]:
39
        raise NotImplementedError