Skip to content

Commit

Permalink
Refs #92. remove work dir at the end if clean "on the fly". improved …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
yxqd committed Jan 11, 2018
1 parent 85fb4cf commit ac0cba0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion python/imars3d/CT.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,13 @@ def recon(self, workdir=None, outdir=None, tilt=None, crop_window=None,
if remove_rings:
self.removeRings(recon)
# clean up
import shutil
if self.clean_intermediate_files == 'archive':
import shutil
import datetime
now = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
shutil.move(workdir, os.path.join(outdir, 'work-%s' % now))
elif self.clean_intermediate_files == 'on_the_fly':
shutil.rmtree(workdir)
return


Expand Down
7 changes: 6 additions & 1 deletion tests/workflows/recon/test_CT_travisCI.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,21 @@ def test(nodes):
parallel_nodes=nodes,
)
ct.recon(tilt=-1.40, explore_rot_center=False)
assert not os.path.exists('work')
return

def test2(nodes):
ct = CT(
dir,
clean_on_the_fly='archive',
clean_intermediate_files='archive',
vertical_range=slice(900, 1000),
parallel_nodes=nodes,
skip_df = True
)
ct.recon(tilt=-1.40, explore_rot_center=False)
assert not os.path.exists('work')
import glob
assert glob.glob('out/work-*')
return

def test3(nodes):
Expand All @@ -51,6 +55,7 @@ def test3(nodes):
parallel_nodes=nodes,
)
ct.recon(tilt=-1.40, explore_rot_center=False)
assert os.path.exists('work')
return


Expand Down

0 comments on commit ac0cba0

Please sign in to comment.