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