summaryrefslogtreecommitdiff
path: root/kpov_judge/rm_task.py
blob: e724d684fd5075833ab1a0cbda28dfc8bdda6a3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/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.student_computers.remove({'task_id': task_id})
    db.results.remove({'task_id': task_id})
    db.gen_params.remove({'task_id': task_id})
    db.task_params_meta.remove({'task_id': task_id})
    db.task_params.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})