Skip to content

Commit

Permalink
Create container arg checking
Browse files Browse the repository at this point in the history
  • Loading branch information
maouw committed Sep 20, 2023
1 parent 462b46a commit 7247d28
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions hyakvnc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,15 @@ def cmd_create(container_path: Union[str, Path], dry_run=False) -> SlurmJob:
container_path = Path(container_path)
container_name = container_path.stem

if not re.match(r"(?P<container_type>library|docker|shub|oras)://(?P<container_path>.*)", container_path):
container_path = container_path.expanduser()
assert(container_path.is_file()), f"Could not find container at {container_path}"
if not container_path.is_file():
container_path = str(container_path)
assert re.match(r"(?P<container_type>library|docker|shub|oras)://(?P<container_path>.*)", container_path), \
f"Container path {container_path} is not a valid URI"

else:
container_path = str(container_path)
logging.debug(f"Container path {container_path} is a URI, not checking for file existence")
container_path = container_path.expanduser()
assert container_path.exists(), f"Container path {container_path} does not exist"
assert container_path.is_file(), f"Container path {container_path} is not a file"

cmds = ["sbatch", "--parsable", "--job-name", app_config.job_prefix + container_name]

Expand Down

0 comments on commit 7247d28

Please sign in to comment.