-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new network plugin architecture for agent
- Loading branch information
1 parent
4dfbe5f
commit 66b67b4
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python_sources(name="src") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from abc import ABCMeta, abstractmethod | ||
from typing import Any | ||
|
||
from ai.backend.agent.kernel import AbstractKernel | ||
from ai.backend.common.plugin import AbstractPlugin, BasePluginContext | ||
from ai.backend.common.types import ClusterInfo, KernelCreationConfig | ||
|
||
|
||
class AbstractNetworkAgentPlugin(AbstractPlugin, metaclass=ABCMeta): | ||
@abstractmethod | ||
async def join_network( | ||
self, | ||
kernel_config: KernelCreationConfig, | ||
cluster_info: ClusterInfo, | ||
**kwargs, | ||
) -> dict[str, Any]: | ||
""" | ||
Returns required container config to attach container to network. | ||
""" | ||
raise NotImplementedError | ||
|
||
@abstractmethod | ||
async def leave_network( | ||
self, | ||
kernel: AbstractKernel, | ||
) -> None: | ||
""" | ||
Performs extra step to make container leave from the network. | ||
""" | ||
raise NotImplementedError | ||
|
||
|
||
class NetworkPluginContext(BasePluginContext[AbstractNetworkAgentPlugin]): | ||
plugin_group = "backendai_network_client_v1" |