|
|
|
@@ -306,14 +306,15 @@ class LearnwareClient: |
|
|
|
the option for instantiating learnwares |
|
|
|
- "normal": instantiate learnware without installing environment |
|
|
|
- "conda_env": instantiate learnware with installing conda virtual environment |
|
|
|
- "docker": instantiate learnware with creating docker container |
|
|
|
|
|
|
|
Returns |
|
|
|
------- |
|
|
|
Learnware |
|
|
|
The contructed learnware object or object list |
|
|
|
""" |
|
|
|
if runnable_option is not None and runnable_option not in ["normal", "conda_env"]: |
|
|
|
raise logger.warning(f"runnable_option must be one of ['normal', 'conda_env'], but got {runnable_option}") |
|
|
|
if runnable_option is not None and runnable_option not in ["normal", "conda_env", "docker"]: |
|
|
|
raise logger.warning(f"runnable_option must be one of ['normal', 'conda_env', 'docker'], but got {runnable_option}") |
|
|
|
|
|
|
|
if learnware_path is None and learnware_id is None: |
|
|
|
raise ValueError("Requires one of learnware_path or learnware_id") |
|
|
|
@@ -379,7 +380,10 @@ class LearnwareClient: |
|
|
|
for i in range(len(learnware_list)): |
|
|
|
learnware_list[i].instantiate_model() |
|
|
|
elif runnable_option == "conda_env": |
|
|
|
with LearnwaresContainer(learnware_list, zip_paths, cleanup=False) as env_container: |
|
|
|
with LearnwaresContainer(learnware_list, zip_paths, cleanup=False, mode="conda") as env_container: |
|
|
|
learnware_list = env_container.get_learnwares_with_container() |
|
|
|
elif runnable_option == "docker": |
|
|
|
with LearnwaresContainer(learnware_list, zip_paths, cleanup=False, mode="docker") as env_container: |
|
|
|
learnware_list = env_container.get_learnwares_with_container() |
|
|
|
|
|
|
|
if len(learnware_list) == 1: |
|
|
|
|