summaryrefslogtreecommitdiff
path: root/tko/delete_job_results
blob: f747510e1797d4ffebc5095e744daf7502deaf7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/python
import os, sys, shutil
thisdir = os.path.dirname(os.path.abspath(sys.argv[0]))
sys.path.insert(0, os.path.abspath(os.path.join(thisdir, '../tko')))
import db

usage = "usage: delete_job_results <job tag>"

if len(sys.argv) < 2:
    print usage
    sys.exit(2)
tag = sys.argv[1]
resultsdir = os.path.abspath(os.path.join(thisdir, '../results', tag))

db = db.db()
if not db.find_job(tag):
    raise "Job tag %s does not exist in database" % tag

db.delete_job(tag)
shutil.rmtree(resultsdir)