@@ -52,9 +52,9 @@ def run(self, **kwargs): # type: (**Any) -> None
52
52
_logger .warn (u"Failed to evaluate expression:\n %s" , e , exc_info = (e if kwargs .get ('debug' ) else False ))
53
53
self .output_callback ({}, "permanentFail" )
54
54
55
- def job (self , joborder , input_basedir , output_callback , ** kwargs ):
55
+ def job (self , joborder , output_callback , ** kwargs ):
56
56
# type: (Dict[str,str], str, Callable[[Any, Any], Any], **Any) -> Generator[ExpressionTool.ExpressionJob, None, None]
57
- builder = self ._init_job (joborder , input_basedir , ** kwargs )
57
+ builder = self ._init_job (joborder , ** kwargs )
58
58
59
59
j = ExpressionTool .ExpressionJob ()
60
60
j .builder = builder
@@ -119,19 +119,19 @@ def __init__(self, toolpath_object, **kwargs):
119
119
def makeJobRunner (self ): # type: () -> CommandLineJob
120
120
return CommandLineJob ()
121
121
122
- def makePathMapper (self , reffiles , input_basedir , ** kwargs ):
122
+ def makePathMapper (self , reffiles , ** kwargs ):
123
123
# type: (Set[str], str, **Any) -> PathMapper
124
124
dockerReq , _ = self .get_requirement ("DockerRequirement" )
125
125
try :
126
126
if dockerReq and kwargs .get ("use_container" ):
127
- return DockerPathMapper (reffiles , input_basedir )
127
+ return DockerPathMapper (reffiles , kwargs [ "basedir" ] )
128
128
else :
129
- return PathMapper (reffiles , input_basedir )
129
+ return PathMapper (reffiles , kwargs [ "basedir" ] )
130
130
except OSError as e :
131
131
if e .errno == errno .ENOENT :
132
132
raise WorkflowException (u"Missing input file %s" % e )
133
133
134
- def job (self , joborder , input_basedir , output_callback , ** kwargs ):
134
+ def job (self , joborder , output_callback , ** kwargs ):
135
135
# type: (Dict[str,str], str, Callable[..., Any], **Any) -> Generator[Union[CommandLineJob, CallbackJob], None, None]
136
136
137
137
jobname = uniquename (kwargs .get ("name" , shortname (self .tool .get ("id" , "job" ))))
@@ -140,9 +140,9 @@ def job(self, joborder, input_basedir, output_callback, **kwargs):
140
140
cacheargs = kwargs .copy ()
141
141
cacheargs ["outdir" ] = "/out"
142
142
cacheargs ["tmpdir" ] = "/tmp"
143
- cachebuilder = self ._init_job (joborder , input_basedir , ** cacheargs )
143
+ cachebuilder = self ._init_job (joborder , ** cacheargs )
144
144
cachebuilder .pathmapper = PathMapper (set ((f ["path" ] for f in cachebuilder .files )),
145
- input_basedir )
145
+ kwargs [ "basedir" ] )
146
146
147
147
cmdline = flatten (map (cachebuilder .generate_arg , cachebuilder .bindings ))
148
148
(docker_req , docker_is_req ) = self .get_requirement ("DockerRequirement" )
@@ -198,7 +198,7 @@ def rm_pending_output_callback(output_callback, jobcachepending,
198
198
partial (rm_pending_output_callback , output_callback ,
199
199
jobcachepending ))
200
200
201
- builder = self ._init_job (joborder , input_basedir , ** kwargs )
201
+ builder = self ._init_job (joborder , ** kwargs )
202
202
203
203
reffiles = set ((f ["path" ] for f in builder .files ))
204
204
@@ -232,7 +232,7 @@ def rm_pending_output_callback(output_callback, jobcachepending,
232
232
if os .path .isabs (j .stdout ) or ".." in j .stdout :
233
233
raise validate .ValidationException ("stdout must be a relative path" )
234
234
235
- builder .pathmapper = self .makePathMapper (reffiles , input_basedir , ** kwargs )
235
+ builder .pathmapper = self .makePathMapper (reffiles , ** kwargs )
236
236
builder .requirements = j .requirements
237
237
238
238
# map files to assigned path inside a container. We need to also explicitly
@@ -298,7 +298,7 @@ def collect_output_ports(self, ports, builder, outdir):
298
298
custom_output = os .path .join (outdir , "cwl.output.json" )
299
299
if builder .fs_access .exists (custom_output ):
300
300
with builder .fs_access .open (custom_output , "r" ) as f :
301
- ret = yaml .load (f )
301
+ ret = json .load (f )
302
302
_logger .debug (u"Raw output from %s: %s" , custom_output , json .dumps (ret , indent = 4 ))
303
303
adjustFileObjs (ret , remove_hostfs )
304
304
adjustFileObjs (ret ,
@@ -338,7 +338,9 @@ def collect_output(self, schema, builder, outdir):
338
338
globpatterns .extend (aslist (gb ))
339
339
340
340
for gb in globpatterns :
341
- if gb .startswith ("/" ):
341
+ if gb .startswith (outdir ):
342
+ gb = gb [len (outdir )+ 1 :]
343
+ elif gb .startswith ("/" ):
342
344
raise WorkflowException ("glob patterns must not start with '/'" )
343
345
try :
344
346
r .extend ([{"path" : g , "class" : "File" , "hostfs" : True }
0 commit comments