diff options
-rwxr-xr-x | kpov_judge/rm_task.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/kpov_judge/rm_task.py b/kpov_judge/rm_task.py new file mode 100755 index 0000000..e4b37c7 --- /dev/null +++ b/kpov_judge/rm_task.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import pymongo +from bson.son import SON +from bson import Binary +import sys +import inspect +import kpov_random_helpers +import settings +import glob +import os + + +if __name__ == '__main__': + if len(sys.argv) < 2: + print u"Usage: {0} [task_name]".format(sys.argv[0]) + exit(1) + task_id = sys.argv[1] + db = pymongo.Connection(settings.DB_HOST).kpov + try: + db.authenticate(settings.USERNAME, settings.PASSWORD) + except Exception, e: + print "Not authenticated:"+str(e) + #no auth or auth config? + db.computers_meta.remove({'task_id': task_id}) + db.networks.remove({'task_id': task_id}) + db.task_checkers.remove({'task_id': task_id}) + db.tasks.remove({'task_id': task_id}) + db.prepare_disks.remove({'task_id': task_id}) + db.gen_params.remove({'task_id': task_id}) + db.task_params_meta.remove({'task_id': task_id}) + db.task_instructions.remove({'task_id': task_id}) + db.howtos.remove({'task_id': task_id}) + db.howto_images.remove({'task_id': task_id}) |