Skip to content

Commit cdc03a4

Browse files
committed
Attempting fix of recursion directory bug.
During a tree decomposition, if both subtrees have multiple recursion steps, the 'recursion_index' of one of the SateAlignerJob instances falls behind. This causes it to try to create the same temporary recursion directory a second time, which triggers an OSError. This commit makes the 'recursion_index' a global variable of the SateAlignerJob class, which should fix this bug.
1 parent b48ba70 commit cdc03a4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

sate/satealignerjob.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ class SateAlignerJob(TreeHolder):
5858
BEHAVIOUR_DEFAULTS = { 'break_strategy' : tuple(['centroid']) ,
5959
'max_subproblem_size' : 50,
6060
'delete_temps' : True}
61+
RECURSION_INDEX = 0
6162
def __init__(self,
6263
multilocus_dataset,
6364
sate_team,
6465
tree,
6566
tmp_base_dir,
66-
recursion_index=0,
6767
tmp_dir_par=None,
6868
**kwargs):
6969
self._job_lock = Lock()
@@ -83,7 +83,6 @@ def __init__(self,
8383
self.context_str = ''
8484
self.killed = False
8585
self._dirs_to_cleanup = []
86-
self.recursion_index = recursion_index
8786
self.tmp_dir_par = tmp_dir_par
8887
if self.tmp_dir_par == None:
8988
self.tmp_dir_par = self.tmp_base_dir
@@ -150,7 +149,7 @@ def _get_subjob_dir(self, num):
150149
at the end of _start_merger.
151150
'''
152151
assert(self.tmp_base_dir)
153-
rn = "r%d" % self.recursion_index
152+
rn = "r%d" % SateAlignerJob.RECURSION_INDEX
154153
dn = "d%d" % num
155154
sd = os.path.join(self.tmp_base_dir, rn, dn)
156155
full_path_to_new_dir = self.sate_team.temp_fs.create_subdir(sd)
@@ -312,20 +311,18 @@ def bipartition_by_tree(self, option):
312311
multilocus_dataset2 = self.multilocus_dataset.sub_alignment(tree2.leaf_node_names())
313312
sd1 = self._get_subjob_dir(1)
314313
sd2 = self._get_subjob_dir(2)
315-
self.recursion_index += 1
314+
SateAlignerJob.RECURSION_INDEX += 1
316315
configuration = self.configuration()
317316
return [SateAlignerJob(multilocus_dataset=multilocus_dataset1,
318317
sate_team=self.sate_team,
319318
tree=tree1,
320319
tmp_base_dir=self.tmp_base_dir,
321-
recursion_index=self.recursion_index,
322320
tmp_dir_par=sd1,
323321
**configuration),
324322
SateAlignerJob(multilocus_dataset=multilocus_dataset2,
325323
sate_team=self.sate_team,
326324
tree=tree2,
327325
tmp_base_dir=self.tmp_base_dir,
328-
recursion_index=self.recursion_index,
329326
tmp_dir_par=sd2,
330327
**configuration)]
331328

0 commit comments

Comments
 (0)