diff --git a/hyakvnc/__main__.py b/hyakvnc/__main__.py index a938a53..9e7aeaa 100644 --- a/hyakvnc/__main__.py +++ b/hyakvnc/__main__.py @@ -14,7 +14,8 @@ from pathlib import Path from typing import Optional, Union -from .HyakVncInstance import HyakVncInstance +from .apptainer import ApptainerInstanceInfo +from .vnc_instance import HyakVncInstance from .config import HyakVncConfig from .slurmutil import wait_for_job_status, get_job, get_historical_job, cancel_job from .util import wait_for_file, repeat_until diff --git a/hyakvnc/ApptainerInstanceInfo.py b/hyakvnc/apptainer.py similarity index 100% rename from hyakvnc/ApptainerInstanceInfo.py rename to hyakvnc/apptainer.py diff --git a/hyakvnc/HyakVncInstance.py b/hyakvnc/vnc_instance.py similarity index 96% rename from hyakvnc/HyakVncInstance.py rename to hyakvnc/vnc_instance.py index 37746d2..42da9a0 100644 --- a/hyakvnc/HyakVncInstance.py +++ b/hyakvnc/vnc_instance.py @@ -4,13 +4,13 @@ from pathlib import Path from typing import Optional, Union -from .ApptainerInstanceInfo import ApptainerInstanceInfo +from .apptainer import ApptainerInstanceInfo from .slurmutil import get_job, cancel_job from .util import check_remote_pid_exists_and_port_open, check_remote_pid_exists, check_remote_port_open class HyakVncInstance: - def __init__(self, apptainer_instance_info: ApptainerInstanceInfo, instance_prefix: str = None, + def __init__(self, apptainer_instance_info: ApptainerInstanceInfo.ApptainerInstanceInfo, instance_prefix: str = None, apptainer_config_dir: Optional[Union[str, Path]] = None): self.apptainer_instance_info = apptainer_instance_info apptainer_config_dir = apptainer_config_dir or Path("~/.apptainer") @@ -124,7 +124,7 @@ def load_instance(instance_prefix: str, instance_name: Optional[str] = None, assert path.is_file(), f"Could not find apptainer instance file at {path}" - apptainer_instance_info = ApptainerInstanceInfo.from_json(path, read_config=read_apptainer_config) + apptainer_instance_info = ApptainerInstanceInfo.ApptainerInstanceInfo.from_json(path, read_config=read_apptainer_config) hyakvnc_instance = HyakVncInstance(apptainer_instance_info=apptainer_instance_info, instance_prefix=instance_prefix, apptainer_config_dir=apptainer_config_dir) return hyakvnc_instance @@ -144,7 +144,7 @@ def find_running_instances(instance_prefix: str, apptainer_config_dir: Optional[ [f for fs in [p.rglob(instance_prefix + '*.json') for p in compute_directories] for f in fs]) vnc_instance_files = set([p for p in all_instance_files if re.match(rf"^{instance_prefix}-\d+", p.name)]) for p in vnc_instance_files: - instance_info = ApptainerInstanceInfo.from_json(p) + instance_info = ApptainerInstanceInfo.ApptainerInstanceInfo.from_json(p) instance = HyakVncInstance(instance_info, instance_prefix=instance_prefix, apptainer_config_dir=apptainer_config_dir) if instance.is_alive():