ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/CleanerServer.py
Revision: 1.5
Committed: Tue Apr 28 16:18:31 2009 UTC (16 years ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_6_0_pre2, CRAB_2_6_0_pre1
Changes since 1.4: +2 -1 lines
Log Message:
printout

File Contents

# User Rev Content
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 slacapra 1.5 msg+='only local worling directory will be removed'
48     #msg+='planned for CRAB_2_5_0'
49 spiga 1.2 common.logger.message(msg)
50 slacapra 1.4 common.work_space.delete()
51     print 'directory '+common.work_space.topDir()+' removed'