196b9a5ae02a1a51a7fbe52f58d0aab2262948511mbligh#!/usr/bin/python
296b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighimport os, sys, shutil
396b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighthisdir = os.path.dirname(os.path.abspath(sys.argv[0]))
496b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighsys.path.insert(0, os.path.abspath(os.path.join(thisdir, '../tko')))
596b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighimport db
696b9a5ae02a1a51a7fbe52f58d0aab2262948511mbligh
796b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighusage = "usage: delete_job_results <job tag>"
896b9a5ae02a1a51a7fbe52f58d0aab2262948511mbligh
996b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighif len(sys.argv) < 2:
100afbb6369aa5aa9a75ea67dd9e95ec4b21c0c181jadmanski    print usage
110afbb6369aa5aa9a75ea67dd9e95ec4b21c0c181jadmanski    sys.exit(2)
1296b9a5ae02a1a51a7fbe52f58d0aab2262948511mblightag = sys.argv[1]
1396b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighresultsdir = os.path.abspath(os.path.join(thisdir, '../results', tag))
1496b9a5ae02a1a51a7fbe52f58d0aab2262948511mbligh
1596b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighdb = db.db()
1696b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighif not db.find_job(tag):
170afbb6369aa5aa9a75ea67dd9e95ec4b21c0c181jadmanski    raise "Job tag %s does not exist in database" % tag
1896b9a5ae02a1a51a7fbe52f58d0aab2262948511mbligh
1996b9a5ae02a1a51a7fbe52f58d0aab2262948511mblighdb.delete_job(tag)
207a41a864cd724d079e5b0159ebb84b34fa80e5fbmblighshutil.rmtree(resultsdir)
21