@@ -73,6 +73,7 @@ def __init__(self,
7373 self .file_objects = {}
7474 self .task_map = {}
7575 self .task_shell = {}
76+ self .task_threads = {}
7677 self .task_input_files = {}
7778 self .task_output_files = {}
7879 self .file_input_output = {}
@@ -140,6 +141,7 @@ def _build_task_map(self):
140141 for row in rows :
141142 task_idx = row [0 ]
142143 rule_idx = row [3 ]
144+ threads = int (row [9 ])
143145 # Shell command
144146 if row [8 ]:
145147 command_list = [x .rstrip ().lstrip () for x in row [8 ].lstrip ().rstrip ().split ('\n ' )]
@@ -150,6 +152,7 @@ def _build_task_map(self):
150152 continue
151153 self .task_map [task_idx ] = rules [rule_idx ] + "_" + str (task_idx )
152154 self .task_shell [task_idx ] = shell_cmd
155+ self .task_threads [task_idx ] = threads
153156 self .task_input_files [task_idx ] = []
154157 self .task_output_files [task_idx ] = []
155158
@@ -159,10 +162,17 @@ def _build_file_map(self):
159162 cursor .execute ("SELECT * FROM files" )
160163 rows = cursor .fetchall ()
161164 for row in rows :
165+ file_type = row [2 ]
166+ # Skip snakemake's BENCHMARK files (and besides snkmt doesn't deal with them correctly!)
167+ # and LOG files (which sometimes are missing anyway)
168+ if file_type == "BENCHMARK" or file_type == "LOG" :
169+ continue
162170 task_idx = row [3 ]
163171 if task_idx not in self .task_input_files and task_idx not in self .task_output_files :
164172 continue
165173 full_path = row [1 ]
174+ # clean path
175+ full_path = full_path .split (" (access:" )[0 ].split (" (cached)" )[0 ].strip ()
166176 if self .path_prefix_rewrite :
167177 full_path = full_path .replace (self .path_prefix_rewrite [0 ], self .path_prefix_rewrite [1 ])
168178 file_size = os .path .getsize (f"{ full_path } " )
@@ -216,6 +226,7 @@ def _create_tasks(self):
216226 input_files = input_files ,
217227 output_files = output_files ,
218228 program = program_name ,
229+ cores = self .task_threads [idx ],
219230 args = program_args ,
220231 logger = self .logger )
221232 self .workflow .add_task (task )
0 commit comments