1 |
corvo |
1.1 |
from Actor import *
|
2 |
mcinquil |
1.8 |
from crab_util import *
|
3 |
farinafa |
1.11 |
import common
|
4 |
|
|
from ApmonIf import ApmonIf
|
5 |
|
|
import time
|
6 |
|
|
|
7 |
|
|
import traceback
|
8 |
|
|
from xml.dom import minidom
|
9 |
|
|
from ServerCommunicator import ServerCommunicator
|
10 |
corvo |
1.1 |
|
11 |
|
|
|
12 |
|
|
class KillerServer(Actor):
|
13 |
farinafa |
1.11 |
def __init__(self, cfg_params, range):
|
14 |
corvo |
1.1 |
self.cfg_params = cfg_params
|
15 |
farinafa |
1.2 |
self.range = range
|
16 |
farinafa |
1.11 |
|
17 |
spiga |
1.12 |
# init client server params...
|
18 |
|
|
CliServerParams(self)
|
19 |
farinafa |
1.11 |
|
20 |
corvo |
1.1 |
return
|
21 |
|
|
|
22 |
|
|
def run(self):
|
23 |
|
|
"""
|
24 |
|
|
The main method of the class: kill a complete task
|
25 |
|
|
"""
|
26 |
|
|
common.logger.debug(5, "Killer::run() called")
|
27 |
|
|
|
28 |
farinafa |
1.11 |
## register proxy ##
|
29 |
spiga |
1.12 |
csCommunicator = ServerCommunicator(self.server_name, self.server_port, self.cfg_params)
|
30 |
farinafa |
1.11 |
|
31 |
|
|
taskuuid = str(common._db.queryTask('name'))
|
32 |
|
|
ret = csCommunicator.killJobs( taskuuid, self.range)
|
33 |
|
|
del csCommunicator
|
34 |
|
|
|
35 |
|
|
if ret != 0:
|
36 |
|
|
msg = "ClientServer ERROR: %d raised during the communication.\n"%ret
|
37 |
|
|
raise CrabException(msg)
|
38 |
|
|
|
39 |
|
|
# update runningjobs status
|
40 |
|
|
updList = [{'statusScheduler':'Killed', 'status':'K'}] * len(self.range)
|
41 |
|
|
common._db.updateRunJob_(self.range, updList)
|
42 |
corvo |
1.1 |
return
|
43 |
|
|
|