1 #!/usr/bin/python 2 import os, sys, shutil 3 thisdir = os.path.dirname(os.path.abspath(sys.argv[0])) 4 sys.path.insert(0, os.path.abspath(os.path.join(thisdir, '../tko'))) 5 import db 6 7 usage = "usage: delete_job_results <job tag>" 8 9 if len(sys.argv) < 2: 10 print usage 11 sys.exit(2) 12 tag = sys.argv[1] 13 resultsdir = os.path.abspath(os.path.join(thisdir, '../results', tag)) 14 15 db = db.db() 16 if not db.find_job(tag): 17 raise "Job tag %s does not exist in database" % tag 18 19 db.delete_job(tag) 20 shutil.rmtree(resultsdir) 21