2525
2626class NextflowLogsParser (LogsParser ):
2727 """"
28- Parse Nextflow execution directory to generate a workflow trace. The workflow
29- must have been executed with two features enabled: 1) the nf-prov plugin, and
28+ Parse Nextflow execution directory to generate a workflow trace. Note that the workflow
29+ reconstruction is not perfect, and will likely only capture file-based data dependencies.
30+ The workflow must have been executed with two features enabled: 1) the nf-prov plugin, and
3031 2) execution tracing. This can be achieved by invoking Nextflow with a config
3132 file, e.g.::
3233
@@ -60,6 +61,8 @@ class NextflowLogsParser(LogsParser):
6061 :type execution_dir: pathlib.Path
6162 :param nextflow_version: The Nextflow version used to execute the workflow
6263 :type nextflow_version: str
64+ :param trace_file_name_pattern: The trace file name pattern to find the trace file (default: "*trace*.txt")
65+ :type trace_file_name_pattern: str
6366 :param description: Workflow instance description.
6467 :type description: Optional[str]
6568 :param logger: The logger where to log information/warning or errors (optional).
@@ -69,6 +72,7 @@ class NextflowLogsParser(LogsParser):
6972 def __init__ (self ,
7073 execution_dir : pathlib .Path ,
7174 nextflow_version : str ,
75+ trace_file_name_pattern : Optional [str ] = "*trace*.txt" ,
7276 description : Optional [str ] = None ,
7377 logger : Optional [Logger ] = None ) -> None :
7478 """Create an object of the nextflow log parser."""
@@ -78,8 +82,8 @@ def __init__(self,
7882 self .execution_dir = execution_dir
7983
8084 # Load the Nextflow execution trace, and create a task runtime dictionary
81- nextflow_execution_trace_files = list (self .execution_dir .rglob ("execution_trace_*.txt" ))
82- if len (nextflow_execution_trace_files ) == 0 :
85+ self . nextflow_execution_trace_files = list (self .execution_dir .rglob (trace_file_name_pattern ))
86+ if len (self . nextflow_execution_trace_files ) == 0 :
8387 raise FileNotFoundError ("No execution_trace_*.txt file found in Nextflow execution directory." )
8488
8589
@@ -94,11 +98,8 @@ def build_workflow(self, workflow_name: Optional[str] = None) -> Workflow:
9498 :rtype: Workflow
9599 """
96100
97- # Parse the Nextflow execution trace to create a dict of task runtimes
98- nextflow_execution_trace_files = list (self .execution_dir .rglob ("execution_trace_*.txt" ))
99- if len (nextflow_execution_trace_files ) == 0 :
100- raise FileNotFoundError ("No execution_trace_*.txt file found in Nextflow execution directory." )
101- nextflow_execution_trace_file : pathlib .Path = max (nextflow_execution_trace_files ,
101+ # Parse the Nextflow (most recent) execution trace file to create a dict of task runtimes
102+ nextflow_execution_trace_file : pathlib .Path = max (self .nextflow_execution_trace_files ,
102103 key = lambda p : p .stat ().st_mtime )
103104 nextflow_task_runtimes = self ._load_nextflow_trace (nextflow_execution_trace_file )
104105
0 commit comments