ersilia.hub.fetch.pack.fastapi_pack package¶
Submodules¶
ersilia.hub.fetch.pack.fastapi_pack.mode module¶
- class ersilia.hub.fetch.pack.fastapi_pack.mode.PackModeDecision(model_id: str, config_json: dict)[source]¶
Bases:
ErsiliaBase
Class to decide the mode of operation for a model based on its configuration and the environment.
- Parameters:
model_id (str) – The identifier of the model.
config_json (dict) – The configuration JSON for the model.
Examples
pmd = PackModeDecision( model_id="model123", config_json={} ) mode = pmd.decide()
- decide() str [source]¶
Decide the mode of operation for the model.
- Returns:
The mode of operation, either “system” or “conda”.
- Return type:
str
- decide_from_config_file_if_available() str [source]¶
Decide the mode from the configuration file if available.
- Returns:
The mode specified in the configuration file, or None if not specified.
- Return type:
str
- Raises:
Exception – If the default_mode in the configuration file is not one of the AVAILABLE_MODES.
ersilia.hub.fetch.pack.fastapi_pack.runners module¶
- class ersilia.hub.fetch.pack.fastapi_pack.runners.CondaPack(model_id: str, config_json: dict)[source]¶
Bases:
BasePack
CondaPack is responsible for packing models within a Conda environment.
- Parameters:
model_id (str) – The ID of the model to be packed.
config_json (dict) – Configuration settings for the packer.
Examples
packer = CondaPack( model_id="eosxxxx", config_json=config ) packer.run()
- run(**kwargs)¶
- class ersilia.hub.fetch.pack.fastapi_pack.runners.SystemPack(model_id: str, config_json: dict)[source]¶
Bases:
BasePack
SystemPack is responsible for packing models with system installation.
- Parameters:
model_id (str) – The ID of the model to be packed.
config_json (dict) – Configuration settings for the packer.
Examples
packer = SystemPack( model_id="eosxxxx", config_json=config ) packer.run()
- ersilia.hub.fetch.pack.fastapi_pack.runners.get_runner(pack_mode: str)[source]¶
Get the appropriate runner based on the pack mode.
- Parameters:
pack_mode (str) – The mode of packing, either ‘system’ or ‘conda’.
- Returns:
The class of the appropriate packer.
- Return type:
type
Examples
runner_class = get_runner(pack_mode="system") runner = runner_class( model_id="eosxxxx", config_json=config )