@@ -309,12 +309,9 @@ def cmdline(self):
309309 def container_args (self ):
310310 if self .inputs .container is None :
311311 raise AttributeError ("Container software is not specified" )
312- cargs = [self .inputs .container , "run" ]
313- if self .inputs .container_xargs is not None :
314- cargs .extend (self .inputs .container_xargs )
312+ cargs = [self .inputs .container ]
315313 if self .inputs .image is None :
316314 raise AttributeError ("Container image is not specified" )
317- cargs .append (self .inputs .image )
318315 return cargs
319316
320317 @property
@@ -351,7 +348,6 @@ def binds(self, opt):
351348 for (key , val ) in self .bind_paths .items ():
352349 bargs .extend ([opt , "{0}:{1}:{2}" .format (key , val [0 ], val [1 ])])
353350 # TODO: would need changes for singularity
354- bargs .extend (["-w" , str (self .output_cpath )])
355351 return bargs
356352
357353 def _run_task (self ):
@@ -399,9 +395,14 @@ def __init__(
399395 def container_args (self ):
400396 cargs = super ().container_args
401397 assert self .inputs .container == "docker"
402- # insert bindings before image
403- idx = len (cargs ) - 1
404- cargs [idx :- 1 ] = self .binds ("-v" )
398+ cargs .append ("run" )
399+ if self .inputs .container_xargs is not None :
400+ cargs .extend (self .inputs .container_xargs )
401+
402+ cargs .extend (self .binds ("-v" ))
403+ cargs .extend (["-w" , str (self .output_cpath )])
404+ cargs .append (self .inputs .image )
405+
405406 return cargs
406407
407408
@@ -418,14 +419,10 @@ def __init__(
418419 ** kwargs ,
419420 ):
420421 if input_spec is None :
421- field = dc .field (default_factory = list )
422- field .metadata = {}
423- fields = [("args" , ty .List [str ], field )]
424- input_spec = SpecInfo (
425- name = "Inputs" , fields = fields , bases = (SingularitySpec ,)
426- )
427- super (ContainerTask , self ).__init__ (
422+ input_spec = SpecInfo (name = "Inputs" , fields = [], bases = (SingularitySpec ,))
423+ super (SingularityTask , self ).__init__ (
428424 input_spec = input_spec ,
425+ output_spec = output_spec ,
429426 audit_flags = audit_flags ,
430427 messengers = messengers ,
431428 messenger_args = messenger_args ,
@@ -438,6 +435,11 @@ def __init__(
438435 def container_args (self ):
439436 cargs = super ().container_args
440437 assert self .inputs .container == "singularity"
438+ cargs .append ("exec" )
439+ if self .inputs .container_xargs is not None :
440+ cargs .extend (self .inputs .container_xargs )
441+ cargs .append (self .inputs .image )
442+
441443 # insert bindings before image
442444 idx = len (cargs ) - 1
443445 cargs [idx :- 1 ] = self .binds ("-B" )
0 commit comments