1 |
mcinquil |
1.1 |
from Actor import *
|
2 |
|
|
from crab_exceptions import *
|
3 |
|
|
from crab_logger import Logger
|
4 |
|
|
import common
|
5 |
|
|
import string
|
6 |
|
|
|
7 |
|
|
class CleanerServer(Actor):
|
8 |
|
|
def __init__(self, cfg_params):
|
9 |
|
|
"""
|
10 |
|
|
constructor
|
11 |
|
|
"""
|
12 |
|
|
self.cfg_params = cfg_params
|
13 |
|
|
|
14 |
|
|
def check(self):
|
15 |
|
|
"""
|
16 |
|
|
Check whether no job is still running or not yet retrieved
|
17 |
|
|
"""
|
18 |
spiga |
1.3 |
# get updated status from server
|
19 |
|
|
try:
|
20 |
|
|
from StatusServer import StatusServer
|
21 |
|
|
stat = StatusServer(self.cfg_params)
|
22 |
|
|
stat.resynchClientSide()
|
23 |
|
|
except:
|
24 |
|
|
pass
|
25 |
mcinquil |
1.1 |
|
26 |
|
|
def run(self):
|
27 |
|
|
"""
|
28 |
|
|
remove all
|
29 |
spiga |
1.2 |
|
30 |
mcinquil |
1.1 |
if common.jobDB.nJobs()>0:
|
31 |
|
|
self.check()
|
32 |
|
|
|
33 |
|
|
countEnded = 0
|
34 |
|
|
for nj in range(common.jobDB.nJobs()):
|
35 |
|
|
if common.jobDB.status(nj) in ['Y','K', 'A', 'C']:
|
36 |
|
|
countEnded += 1
|
37 |
|
|
if countEnded == common.jobDB.nJobs():
|
38 |
|
|
tempWorkSpace = common.work_space.topDir()
|
39 |
|
|
common.scheduler.clean()
|
40 |
|
|
common.work_space.delete()
|
41 |
|
|
print ( 'crab. directory '+tempWorkSpace+' removed' )
|
42 |
|
|
else:
|
43 |
|
|
common.logger.message ( 'Impossible to remove: not all jobs are yet finished\n (you maight kill these jobs and then clean the task)')
|
44 |
spiga |
1.2 |
"""
|
45 |
|
|
msg=''
|
46 |
|
|
msg+='functionality not yet available for the server. Work in progres \n'
|
47 |
spiga |
1.3 |
msg+='planned for CRAB_2_5_0'
|
48 |
spiga |
1.2 |
common.logger.message(msg)
|