summaryrefslogtreecommitdiff
path: root/tko/delete_job_results
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2007-11-24 19:32:20 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2007-11-24 19:32:20 +0000
commit0d3a853df755471ed40ced9eaaaa3cbe4c95dd13 (patch)
tree82786b685d128db8813c3a8769430e42d7ff78cd /tko/delete_job_results
parent8ee51a113fbd566e3b552ce250afc5270ed4dd5c (diff)
Add a way to delete an individual set of job results.
People have been asking for a way to delete bad jobs. Signed-off-by: Martin Bligh <mbligh@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@968 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/delete_job_results')
-rw-r--r--tko/delete_job_results23
1 files changed, 23 insertions, 0 deletions
diff --git a/tko/delete_job_results b/tko/delete_job_results
new file mode 100644
index 00000000..ec4c1060
--- /dev/null
+++ b/tko/delete_job_results
@@ -0,0 +1,23 @@
+#!/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))
+
+if not os.path.isdir(resultsdir):
+ raise "Results directory %s does not exist" % resultsdir
+db = db.db()
+if not db.find_job(tag):
+ raise "Job tag %s does not exist in database" % tag
+
+shutil.rmtree(resultsdir)
+db.delete_job(tag)
+