@@ -346,7 +346,9 @@ def rm_pending_output_callback(output_callbacks, jobcachepending,
346
346
j .hints = self .hints
347
347
j .name = jobname
348
348
349
- if _logger .isEnabledFor (logging .DEBUG ):
349
+ debug = _logger .isEnabledFor (logging .DEBUG )
350
+
351
+ if debug :
350
352
_logger .debug (u"[job %s] initializing from %s%s" ,
351
353
j .name ,
352
354
self .tool .get ("id" , "" ),
@@ -405,28 +407,28 @@ def rm_pending_output_callback(output_callbacks, jobcachepending,
405
407
self .updatePathmap (builder .outdir , builder .pathmapper , l )
406
408
visit_class ([builder .files , builder .bindings ], ("File" , "Directory" ), _check_adjust )
407
409
408
- if _logger . isEnabledFor ( logging . DEBUG ) :
410
+ if debug :
409
411
_logger .debug (u"[job %s] path mappings is %s" , j .name ,
410
412
json .dumps ({p : builder .pathmapper .mapper (p ) for p in builder .pathmapper .files ()}, indent = 4 ))
411
413
412
414
if self .tool .get ("stdin" ):
413
- with SourceLine (self .tool , "stdin" , validate .ValidationException ):
415
+ with SourceLine (self .tool , "stdin" , validate .ValidationException , debug ):
414
416
j .stdin = builder .do_eval (self .tool ["stdin" ])
415
417
reffiles .append ({"class" : "File" , "path" : j .stdin })
416
418
417
419
if self .tool .get ("stderr" ):
418
- with SourceLine (self .tool , "stderr" , validate .ValidationException ):
420
+ with SourceLine (self .tool , "stderr" , validate .ValidationException , debug ):
419
421
j .stderr = builder .do_eval (self .tool ["stderr" ])
420
422
if os .path .isabs (j .stderr ) or ".." in j .stderr :
421
423
raise validate .ValidationException ("stderr must be a relative path, got '%s'" % j .stderr )
422
424
423
425
if self .tool .get ("stdout" ):
424
- with SourceLine (self .tool , "stdout" , validate .ValidationException ):
426
+ with SourceLine (self .tool , "stdout" , validate .ValidationException , debug ):
425
427
j .stdout = builder .do_eval (self .tool ["stdout" ])
426
428
if os .path .isabs (j .stdout ) or ".." in j .stdout or not j .stdout :
427
429
raise validate .ValidationException ("stdout must be a relative path, got '%s'" % j .stdout )
428
430
429
- if _logger . isEnabledFor ( logging . DEBUG ) :
431
+ if debug :
430
432
_logger .debug (u"[job %s] command line bindings is %s" , j .name , json .dumps (builder .bindings , indent = 4 ))
431
433
432
434
dockerReq = self .get_requirement ("DockerRequirement" )[0 ]
@@ -505,17 +507,18 @@ def register_reader(f):
505
507
def collect_output_ports (self , ports , builder , outdir , compute_checksum = True , jobname = "" , readers = None ):
506
508
# type: (Set[Dict[Text, Any]], Builder, Text, bool, Text, Dict[Text, Any]) -> Dict[Text, Union[Text, List[Any], Dict[Text, Any]]]
507
509
ret = {} # type: Dict[Text, Union[Text, List[Any], Dict[Text, Any]]]
510
+ debug = _logger .isEnabledFor (logging .DEBUG )
508
511
try :
509
512
fs_access = builder .make_fs_access (outdir )
510
513
custom_output = fs_access .join (outdir , "cwl.output.json" )
511
514
if fs_access .exists (custom_output ):
512
515
with fs_access .open (custom_output , "r" ) as f :
513
516
ret = json .load (f )
514
- if _logger . isEnabledFor ( logging . DEBUG ) :
517
+ if debug :
515
518
_logger .debug (u"Raw output from %s: %s" , custom_output , json .dumps (ret , indent = 4 ))
516
519
else :
517
520
for i , port in enumerate (ports ):
518
- with SourceLine (ports , i , WorkflowException ):
521
+ with SourceLine (ports , i , WorkflowException , debug ):
519
522
fragment = shortname (port ["id" ])
520
523
try :
521
524
ret [fragment ] = self .collect_output (port , builder , outdir , fs_access ,
@@ -554,14 +557,15 @@ def collect_output_ports(self, ports, builder, outdir, compute_checksum=True, jo
554
557
def collect_output (self , schema , builder , outdir , fs_access , compute_checksum = True ):
555
558
# type: (Dict[Text, Any], Builder, Text, StdFsAccess, bool) -> Union[Dict[Text, Any], List[Union[Dict[Text, Any], Text]]]
556
559
r = [] # type: List[Any]
560
+ debug = _logger .isEnabledFor (logging .DEBUG )
557
561
if "outputBinding" in schema :
558
562
binding = schema ["outputBinding" ]
559
563
globpatterns = [] # type: List[Text]
560
564
561
565
revmap = partial (revmap_file , builder , outdir )
562
566
563
567
if "glob" in binding :
564
- with SourceLine (binding , "glob" , WorkflowException ):
568
+ with SourceLine (binding , "glob" , WorkflowException , debug ):
565
569
for gb in aslist (binding ["glob" ]):
566
570
gb = builder .do_eval (gb )
567
571
if gb :
@@ -626,12 +630,12 @@ def collect_output(self, schema, builder, outdir, fs_access, compute_checksum=Tr
626
630
single = True
627
631
628
632
if "outputEval" in binding :
629
- with SourceLine (binding , "outputEval" , WorkflowException ):
633
+ with SourceLine (binding , "outputEval" , WorkflowException , debug ):
630
634
r = builder .do_eval (binding ["outputEval" ], context = r )
631
635
632
636
if single :
633
637
if not r and not optional :
634
- with SourceLine (binding , "glob" , WorkflowException ):
638
+ with SourceLine (binding , "glob" , WorkflowException , debug ):
635
639
raise WorkflowException ("Did not find output file with glob pattern: '{}'" .format (globpatterns ))
636
640
elif not r and optional :
637
641
pass
@@ -642,7 +646,7 @@ def collect_output(self, schema, builder, outdir, fs_access, compute_checksum=Tr
642
646
r = r [0 ]
643
647
644
648
if "secondaryFiles" in schema :
645
- with SourceLine (schema , "secondaryFiles" , WorkflowException ):
649
+ with SourceLine (schema , "secondaryFiles" , WorkflowException , debug ):
646
650
for primary in aslist (r ):
647
651
if isinstance (primary , dict ):
648
652
primary .setdefault ("secondaryFiles" , [])
0 commit comments