Skip to content

Commit 259fda3

Browse files
fix path errors (#424)
* fix path errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix Nonetype Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent acb56df commit 259fda3

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

app/referee/tasks.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import os
23
import tempfile
34
from pathlib import Path
45

@@ -82,13 +83,19 @@ def cache_containers(submission_run, delayed_conditional):
8283
stdout=f"Container details: {container.uri}\n{container.container_type}\n"
8384
)
8485

86+
if container.local_save_path:
87+
save_dir = container.local_save_path.parent.absolute()
88+
if not save_dir.exists():
89+
os.makedirs(container.local_save_path.parent.absolute())
90+
8591
pull_code, stdout, stderr = ever_given.wrapper.pull_container(
8692
container.uri,
8793
container.container_type,
8894
settings.CONTAINER_ENGINE,
8995
container.local_save_path,
9096
aws_login_func,
9197
)
98+
9299
if stderr:
93100
submission_run.append(stderr="Error message when pulling container:\n")
94101
submission_run.append(stderr=stderr)

ever_given/ever_given/engines/singularity_engine.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,18 @@ def pull_container(cls, container_uri, container_type, save_path=None, aws_login
112112
cls.validate_common_arguments(container_type, aws_login_func)
113113

114114
uri = cls.make_uri(container_uri, container_type)
115+
115116
if save_path:
116117
pull_cmd = ["singularity", "pull", "-F", save_path, uri]
117118
else:
118119
pull_cmd = ["singularity", "pull", "-F", uri]
120+
119121
ended_proc = subprocess.run(pull_cmd, capture_output=True)
122+
120123
code = ended_proc.returncode
121124
stdout = ended_proc.stdout.decode("utf-8")
122125
stderr = ended_proc.stderr.decode("utf-8")
126+
123127
return code == 0, stdout, stderr
124128

125129

0 commit comments

Comments
 (0)