Skip to content

Commit

Permalink
Cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
maouw committed Sep 21, 2023
1 parent cfb0aaf commit 56b16a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion hyakvnc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions hyakvnc/HyakVncInstance.py → hyakvnc/vnc_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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():
Expand Down

0 comments on commit 56b16a7

Please sign in to comment.