ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/CleanerServer.py
Revision: 1.6
Committed: Tue May 26 10:23:00 2009 UTC (15 years, 11 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_6_1_pre4, CRAB_2_6_1_pre3, CRAB_2_6_1_pre2, CRAB_2_6_1_pre1, CRAB_2_6_1, CRAB_2_6_0, CRAB_2_6_0_pre14, CRAB_2_6_0_pre13, CRAB_2_6_0_pre12, CRAB_2_6_0_pre11, CRAB_2_6_0_pre10, CRAB_2_6_0_pre9, CRAB_2_6_0_pre8, CRAB_2_6_0_pre7, CRAB_2_6_0_pre6, CRAB_2_6_0_pre5, CRAB_2_6_0_pre4, CRAB_2_6_0_pre3
Changes since 1.5: +2 -3 lines
Log Message:
adapting code to logging usage. (crab_logger removed)

File Contents

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