Files
mlpack/fastlib/trunk/script/fx-cleanup
T

50 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python
USAGE = """fx-cleanup: Clean up results from old trials.
Example:
fx-cleanup knn_k ./main # removes status files of failed trials
fx-cleanup knn_k ./main --purge # removes entire directories of
failed trials
fx-cleanup knn_k ./main --nuke # removes all directories of all trials
The point of fx-cleanup is to allow the re-running of trials.
The normal use (with no special options) allows the re-running of trials
that previously failed, or were interrupted. One would use --nuke if it
is desired to re-run completed trials because perhaps your program changed.
It is also possible just to explore the fx/ directory tree yourself and
remove individual trials by hand -- simple rm -rf will work.
See information on fx-run for more information about status files.
"""
import pm
import util
import fxsys
import fx # use FASTexec argument parsing
import sys
import os
if len(fx.extra_args) < 2:
print USAGE
sys.exit(1)
label = fx.extra_args[0]
exename = os.path.abspath(fx.extra_args[1])
purge = fx.param_bool("purge")
nuke = fx.param_bool("nuke")
experiment = fxsys.SimpleExperiment(os.path.abspath("."), exename, label)
print "*** Experiments stored in: %s" % experiment.path
print "*** Deleting all the following runs:"
experiment.print_status(False, False)
print "-" * 75
experiment.cleanup(purge, nuke)
print "*** Done."