Skip to content

Commit

Permalink
update for singularity fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deaconjs committed Aug 31, 2022
1 parent ce3b472 commit eb7c7f7
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions dist/run_fcsgx.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def __init__(self, args):
self.args = args
self.args.container_db = Path(args.container_db)

def safe_exec(self, args):
if self.args.debug:
print(" ".join(args))
subprocess.run(args, shell=False, check=True, text=True, stdout=sys.stdout, stderr=sys.stderr)

def retrieve_singularity_image(self, local_filename):
ctx = ssl.create_default_context()
ctx.check_hostname = False
Expand Down Expand Up @@ -100,7 +105,7 @@ def run_retrieve_db(self):

retrieve_db_args = [
container_engine,
"run",
"run" if container_engine == "docker" else "exec",
mount_arg,
str(expanded_gxdb) + ":" + str(self.args.container_db),
*extra_docker_args,
Expand All @@ -111,11 +116,7 @@ def run_retrieve_db(self):
str(self.args.container_db / gxdb_name),
*extra_db_args,
]
subprocess.run(
retrieve_db_args,
shell=False,
check=True,
)
self.safe_exec(retrieve_db_args)

def run_gx(self):
expanded_gxdb = Path(os.path.realpath(os.path.dirname(self.args.gx_db)))
Expand All @@ -137,7 +138,7 @@ def run_gx(self):

docker_args = [
container_engine,
"run",
"run" if container_engine == "docker" else "exec",
mount_arg,
str(expanded_gxdb) + ":" + str(self.args.container_db),
mount_arg,
Expand Down Expand Up @@ -167,9 +168,7 @@ def run_gx(self):
if self.args.env_file:
docker_args.extend(["--env-file", str(Path("/sample-volume/") / self.args.env_file)])

if self.args.debug:
print(docker_args)
subprocess.run(docker_args, shell=False, check=True)
self.safe_exec(docker_args)

def run_verify_checksums(self):
expanded_gxdb = Path(os.path.realpath(os.path.dirname(self.args.gx_db)))
Expand All @@ -186,7 +185,7 @@ def run_verify_checksums(self):

docker_args = [
container_engine,
"run",
"run" if container_engine == "docker" else "exec",
mount_arg,
str(expanded_gxdb) + ":" + str(self.args.container_db),
docker_image,
Expand All @@ -196,9 +195,7 @@ def run_verify_checksums(self):
str(self.args.container_db / gxdb_name),
"--debug",
]
if self.args.debug:
print(docker_args)
subprocess.run(docker_args, shell=False, check=True)
self.safe_exec(docker_args)

def run(self):
self.run_retrieve_db()
Expand Down

0 comments on commit eb7c7f7

Please sign in to comment.