Skip to content

Commit fc6bda5

Browse files
committed
modify image name for singularity pull
1 parent c2b4972 commit fc6bda5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cwl_utils/docker_extract.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ def main():
2323
top = cwl.load_document(args.input)
2424

2525
for req in set(traverse(top)):
26-
image_name = get_image_name(req)
2726
if args.singularity:
27+
image_name = get_image_name_singularity(req)
2828
save_docker_image_singularity(req, image_name, args.dir)
2929
else:
30+
image_name = get_image_name(req)
3031
save_docker_image(req, image_name, args.dir)
3132

3233
print(load_docker_image(image_name))
@@ -36,6 +37,15 @@ def get_image_name(req):
3637
return ''.join(req.split('/')) + '.tar'
3738

3839

40+
def get_image_name_singularity(req):
41+
CHARS_TO_REPLACE = ['/', ':']
42+
NEW_CHAR = '-'
43+
image_name = req
44+
for char in CHARS_TO_REPLACE:
45+
image_name = image_name.replace(char, NEW_CHAR)
46+
return f'{image_name}.img'
47+
48+
3949
def load_docker_image(image_name):
4050
return f'udocker load -i {image_name}'
4151

0 commit comments

Comments
 (0)