ai2_kit.core.connector module#
- class ai2_kit.core.connector.LocalConnector[source]#
Bases:
BaseConnector
- class ai2_kit.core.connector.SshConfig(*, host: str, gateway: Optional[SshConfig] = None)[source]#
Bases:
BaseModel
- host: str#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'gateway': FieldInfo(annotation=Union[SshConfig, NoneType], required=False, default=None), 'host': FieldInfo(annotation=str, required=True)}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class ai2_kit.core.connector.SshConnector(connection: Connection)[source]#
Bases:
BaseConnector
- ai2_kit.core.connector.get_ln_cmd(from_path: str, to_path: str)[source]#
The reason to rm -d to_path is to workaround the limit of ln. ln command cannot override existed directory, so we need to ensure to_path is not existed. Here we use -d option instead of -rf to avoid remove directory with content. The error of rm -d is suppressed as it will fail when to_path is file. -T option of ln is used to avoid some unexpected result.