Module Expr Str Import alias Import alias Import alias Import alias Import alias Import alias identifier FunctionDef arguments args NameParam NameParam defaults Num body Expr Str Assign NameStore Call NameLoad NameLoad Str Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr Num Num Assign NameStore Call AttributeLoad NameLoad attr If CompareEq NameLoad Num body Return Str While Num body If CompareLt NameLoad NameLoad body Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr BinOpMult Num NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareEq SubscriptLoad NameLoad Index BinOpSub NameLoad Num Str body Assign NameStore SubscriptLoad NameLoad Slice Num Assign NameStore Call AttributeLoad NameLoad attr Str If CompareGtE Call NameLoad NameLoad Num body Return SubscriptLoad NameLoad Index Num If CompareEq NameLoad NameLoad body Return NameLoad AugAssignAdd NameStore NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Return Call AttributeLoad NameLoad attr Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index Num Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index Num Return CompareGt NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr keyword Str keyword SubscriptLoad Call NameLoad Index Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr keyword Str keyword Str keyword Str keyword ListLoad keyword NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad If NameLoad body Assign NameStore NameLoad orelse If AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Assign NameStore Str Assign TupleStore NameStore NameStore NameStore TupleLoad Num Num Num If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr For NameStore NameLoad body For TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad body AugAssignAdd NameStore Num For NameStore AttributeLoad NameLoad attr body If CompareIn NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad If BoolOpAnd Call AttributeLoad NameLoad attr NameLoad UnaryOpNot Call NameLoad NameLoad body If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Num If CompareGtE AttributeLoad NameLoad attr Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr
N/A N/A 
clean.py - clean up output files from aborted runs
==================================================

:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python

Purpose
-------

This script checks one or more output files have they
have completed successfully. It will remove output files
for those jobs that are incomplete.

The script checks for the "job finished" tag at the
end of the file.

Usage
-----

Example::

   python clean.py --help

Type::

   python clean.py --help

for command line help.

Command line options
--------------------
 N/A os N/A sys N/A re N/A glob N/A os.path N/A CGAT.Experiment E getLastLine N/A N/A filename read_size N/A 1024 N/A N/A return last line of a file.
     N/A f N/A open filename rU N/A offset read_size N/A N/A N/A f seek 0 2 N/A file_size N/A N/A f tell N/A N/A file_size 0 N/A N/A N/A 1 N/A N/A N/A file_size offset N/A N/A offset file_size N/A N/A N/A f seek N/A -1 offset 2 N/A read_str N/A N/A f read offset N/A N/A N/A read_str N/A N/A offset 1 N/A N/A read_str N/A read_str N/A -1 N/A lines N/A N/A read_str split N/A N/A N/A len lines 2 N/A N/A N/A lines N/A -1 N/A N/A offset file_size N/A N/A read_str N/A offset read_size N/A N/A N/A f close N/A checkPythonRuns N/A N/A filename N/A N/A N/A returns true if a python run is complete. N/A last_line N/A getLastLine filename N/A N/A N/A re match # job finished last_line N/A isNewer N/A N/A a b N/A N/A N/A return true if file a is newer than file b. N/A at N/A N/A N/A os stat a N/A 7 N/A bt N/A N/A N/A os stat b N/A 7 N/A N/A at bt N/A main N/A N/A argv N/A None N/A N/A script main.

    parses command line options in sys.argv, unless *argv* is given.
     N/A N/A argv None N/A N/A argv N/A sys argv N/A parser N/A N/A E OptionParser version %prog version: $Id: clean.py 2782 2009-09-10 11:40:29Z andreas $ usage N/A N/A globals N/A __doc__ N/A N/A N/A parser add_option -g --glob dest glob_pattern type string help glob pattern to use for collecting files [%default]. N/A N/A N/A parser add_option -n --dry-run dest dry_run action store_true help only print out actions, do not execute them [%default]. N/A N/A N/A parser add_option -f --file-pattern dest file_pattern type string help only check files matching this pattern [%default]. N/A N/A N/A parser set_defaults glob_pattern data.dir file_pattern .out check_completeness python skip_dirs N/A dry_run False N/A N/A options args N/A N/A E Start parser add_pipe_options True N/A args N/A N/A starts args N/A N/A N/A options glob_pattern N/A N/A starts N/A N/A glob glob N/A options glob_pattern N/A N/A starts . N/A N/A ndirs nfiles ndeleted N/A 0 0 0 N/A N/A N/A options check_completeness python N/A N/A isComplete checkPythonRuns N/A rx N/A N/A re compile N/A options file_pattern N/A start starts N/A N/A N/A root dirs files N/A N/A os walk start N/A N/A ndirs 1 N/A dir N/A options skip_dirs N/A N/A N/A dir dirs N/A N/A N/A N/A dirs remove dir N/A filename files N/A N/A p N/A N/A N/A os path join root filename N/A N/A N/A N/A rx search filename N/A N/A isComplete p N/A N/A N/A options dry_run N/A N/A N/A N/A N/A options stdlog write N/A # removing file %s
 p N/A N/A N/A N/A os remove p N/A ndeleted 1 N/A N/A N/A options loglevel 1 N/A N/A N/A N/A N/A options stdlog write N/A # ndirs=%i, nfiles=%i, ndeleted=%i
 N/A ndirs nfiles ndeleted N/A N/A N/A E Stop N/A N/A N/A __name__ __main__ N/A N/A N/A N/A sys exit N/A main N/A sys argv