Browse Source

[MNT] modify details

tags/v0.3.2
Gene 2 years ago
parent
commit
8cdce7565c
3 changed files with 5 additions and 13 deletions
  1. +0
    -5
      learnware/client/container.py
  2. +4
    -8
      learnware/client/learnware_client.py
  3. +1
    -0
      learnware/client/utils.py

+ 0
- 5
learnware/client/container.py View File

@@ -556,11 +556,6 @@ class LearnwaresContainer:
f"{len(self.learnware_list) - sum(results)} of {len(self.learnware_list)} learnwares init failed! This learnware will be ignored"
)

# if not self.cleanup and self.mode == "docker":
# _model_docker_container = self.learnware_containers[0].get_model()
# _model_docker_container.cleanup_flag = True
# atexit.register(_model_docker_container.remove_env)

return self

def __exit__(self, exc_type, exc_val, exc_tb):


+ 4
- 8
learnware/client/learnware_client.py View File

@@ -316,7 +316,7 @@ class LearnwareClient:
tempdir = self.tempdir_list[-1].name
zip_path = os.path.join(tempdir, f"{str(uuid.uuid4())}.zip")
self.download_learnware(_learnware_id, zip_path)
return zip_path, _get_learnware_by_path(zip_path, tempdir=tempdir)
return _get_learnware_by_path(zip_path, tempdir=tempdir)

def _get_learnware_by_path(_learnware_zippath, tempdir=None):
if tempdir is None:
@@ -346,16 +346,13 @@ class LearnwareClient:
return learnware.get_learnware_from_dirpath(learnware_id, semantic_specification, tempdir)

learnware_list = []
zip_paths = []
if learnware_path is not None:
if isinstance(learnware_path, str):
zip_paths = [learnware_path]
elif isinstance(learnware_path, list):
zip_paths = learnware_path
zip_paths = [learnware_path] if isinstance(learnware_path, str) else learnware_path

for zip_path in zip_paths:
learnware_obj = _get_learnware_by_path(zip_path)
learnware_list.append(learnware_obj)

elif learnware_id is not None:
if isinstance(learnware_id, str):
id_list = [learnware_id]
@@ -363,8 +360,7 @@ class LearnwareClient:
id_list = learnware_id

for idx in id_list:
zip_path, learnware_obj = _get_learnware_by_id(idx)
zip_paths.append(zip_path)
learnware_obj = _get_learnware_by_id(idx)
learnware_list.append(learnware_obj)

if runnable_option is not None:


+ 1
- 0
learnware/client/utils.py View File

@@ -20,6 +20,7 @@ def system_execute(args, timeout=None):

def remove_enviroment(conda_env):
system_execute(args=["conda", "env", "remove", "-n", f"{conda_env}"])
logger.info(f"The learnware conda env [{conda_env}] is removed.")


def install_environment(learnware_dirpath, conda_env):


Loading…
Cancel
Save