@@ -60,14 +60,18 @@ def run(self, **kwargs): # type: (**Any) -> None
60
60
e , exc_info = kwargs .get ('debug' ))
61
61
self .output_callback ({}, "permanentFail" )
62
62
63
- def job (self , joborder , output_callback , ** kwargs ):
64
- # type: (Dict[Text, Text], Callable[[Any, Any], Any], **Any) -> Generator[ExpressionTool.ExpressionJob, None, None]
65
- builder = self ._init_job (joborder , ** kwargs )
63
+ def job (self ,
64
+ job_order , # type: Dict[Text, Text]
65
+ output_callbacks , # type: Callable[[Any, Any], Any]
66
+ ** kwargs # type: Any
67
+ ):
68
+ # type: (...) -> Generator[ExpressionTool.ExpressionJob, None, None]
69
+ builder = self ._init_job (job_order , ** kwargs )
66
70
67
71
j = ExpressionTool .ExpressionJob ()
68
72
j .builder = builder
69
73
j .script = self .tool ["expression" ]
70
- j .output_callback = output_callback
74
+ j .output_callback = output_callbacks
71
75
j .requirements = self .requirements
72
76
j .hints = self .hints
73
77
j .outdir = None
@@ -165,8 +169,12 @@ def makePathMapper(self, reffiles, stagedir, **kwargs):
165
169
dockerReq , _ = self .get_requirement ("DockerRequirement" )
166
170
return PathMapper (reffiles , kwargs ["basedir" ], stagedir )
167
171
168
- def job (self , joborder , output_callback , ** kwargs ):
169
- # type: (Dict[Text, Text], Callable[..., Any], **Any) -> Generator[Union[CommandLineJob, CallbackJob], None, None]
172
+ def job (self ,
173
+ job_order , # type: Dict[Text, Text]
174
+ output_callbacks , # type: Callable[[Any, Any], Any]
175
+ ** kwargs # type: Any
176
+ ):
177
+ # type: (...) -> Generator[Union[CommandLineJob, CallbackJob], None, None]
170
178
171
179
jobname = uniquename (kwargs .get ("name" , shortname (self .tool .get ("id" , "job" ))))
172
180
@@ -175,7 +183,7 @@ def job(self, joborder, output_callback, **kwargs):
175
183
cacheargs ["outdir" ] = "/out"
176
184
cacheargs ["tmpdir" ] = "/tmp"
177
185
cacheargs ["stagedir" ] = "/stage"
178
- cachebuilder = self ._init_job (joborder , ** cacheargs )
186
+ cachebuilder = self ._init_job (job_order , ** cacheargs )
179
187
cachebuilder .pathmapper = PathMapper (cachebuilder .files ,
180
188
kwargs ["basedir" ],
181
189
cachebuilder .stagedir ,
@@ -222,7 +230,7 @@ def job(self, joborder, output_callback, **kwargs):
222
230
cachebuilder .outdir = jobcache
223
231
224
232
_logger .info ("[job %s] Using cached output in %s" , jobname , jobcache )
225
- yield CallbackJob (self , output_callback , cachebuilder , jobcache )
233
+ yield CallbackJob (self , output_callbacks , cachebuilder , jobcache )
226
234
return
227
235
else :
228
236
_logger .info ("[job %s] Output of job will be cached in %s" , jobname , jobcache )
@@ -231,19 +239,19 @@ def job(self, joborder, output_callback, **kwargs):
231
239
kwargs ["outdir" ] = jobcache
232
240
open (jobcachepending , "w" ).close ()
233
241
234
- def rm_pending_output_callback (output_callback , jobcachepending ,
242
+ def rm_pending_output_callback (output_callbacks , jobcachepending ,
235
243
outputs , processStatus ):
236
244
if processStatus == "success" :
237
245
os .remove (jobcachepending )
238
- output_callback (outputs , processStatus )
246
+ output_callbacks (outputs , processStatus )
239
247
240
- output_callback = cast (
248
+ output_callbacks = cast (
241
249
Callable [..., Any ], # known bug in mypy
242
250
# https://github.com/python/mypy/issues/797
243
- partial (rm_pending_output_callback , output_callback ,
251
+ partial (rm_pending_output_callback , output_callbacks ,
244
252
jobcachepending ))
245
253
246
- builder = self ._init_job (joborder , ** kwargs )
254
+ builder = self ._init_job (job_order , ** kwargs )
247
255
248
256
reffiles = copy .deepcopy (builder .files )
249
257
@@ -265,7 +273,7 @@ def rm_pending_output_callback(output_callback, jobcachepending,
265
273
j .name ,
266
274
self .tool .get ("id" , "" ),
267
275
u" as part of %s" % kwargs ["part_of" ] if "part_of" in kwargs else "" )
268
- _logger .debug (u"[job %s] %s" , j .name , json .dumps (joborder , indent = 4 ))
276
+ _logger .debug (u"[job %s] %s" , j .name , json .dumps (job_order , indent = 4 ))
269
277
270
278
builder .pathmapper = None
271
279
make_path_mapper_kwargs = kwargs
@@ -377,7 +385,7 @@ def rm_pending_output_callback(output_callback, jobcachepending,
377
385
j .collect_outputs = partial (
378
386
self .collect_output_ports , self .tool ["outputs" ], builder ,
379
387
compute_checksum = kwargs .get ("compute_checksum" , True ))
380
- j .output_callback = output_callback
388
+ j .output_callback = output_callbacks
381
389
382
390
yield j
383
391
0 commit comments