More robust analysis tool

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4187 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-09-01 20:24:04 +00:00
parent ca503e5801
commit 924e16f4f0
1 changed files with 9 additions and 1 deletions

View File

@ -30,6 +30,10 @@ def main():
type='int', default=None, type='int', default=None,
help="if provided, only records generated within X days of today will be included") help="if provided, only records generated within X days of today will be included")
parser.add_option("", "--D", dest="reallyDeleteInArchiveMode",
action='store_true', default=False,
help="if provided, we'll actually delete records when running in archive mode")
(OPTIONS, args) = parser.parse_args() (OPTIONS, args) = parser.parse_args()
if len(args) == 0: if len(args) == 0:
parser.error("Requires at least GATKRunReport xml to analyze") parser.error("Requires at least GATKRunReport xml to analyze")
@ -39,6 +43,8 @@ def main():
# open up the output file # open up the output file
if OPTIONS.output != None: if OPTIONS.output != None:
if stage == "archive" and os.path.exists(OPTIONS.output):
raise "archive output file already exists, aborting!", OPTIONS.output
out = openFile(OPTIONS.output,'w') out = openFile(OPTIONS.output,'w')
else: else:
out = sys.stdout out = sys.stdout
@ -182,8 +188,10 @@ class Archive(RecordAsXML):
RecordAsXML.__init__(self, name, out) RecordAsXML.__init__(self, name, out)
def finalize(self, args): def finalize(self, args):
RecordAsXML.finalize(self, args)
for arg in args: for arg in args:
print 'Deleting file: ', arg print 'Deleting file: ', arg
if OPTIONS.reallyDeleteInArchiveMode:
os.remove(arg) os.remove(arg)
addHandler('archive', Archive) addHandler('archive', Archive)