ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/CleanerServer.py
Revision: 1.4
Committed: Wed Dec 3 13:56:47 2008 UTC (16 years, 4 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_5_1, CRAB_2_5_1_pre4, CRAB_2_5_1_pre3, CRAB_2_5_1_pre2, CRAB_2_5_1_pre1, CRAB_2_5_0, CRAB_2_5_0_pre7, CRAB_2_5_0_pre6, CRAB_2_5_0_pre5, CRAB_2_5_0_pre4, CRAB_2_5_0_pre3, CRAB_2_5_0_pre2, CRAB_2_5_0_pre1, CRAB_2_4_4, CRAB_2_4_4_pre6, CRAB_2_4_4_pre5, CRAB_2_4_4_pre4, CRAB_2_4_4_pre3, CRAB_2_4_4_pre2, CRAB_2_4_4_pre1, CRAB_2_4_3, CRAB_2_4_3_pre8, CRAB_2_4_3_pre7, CRAB_2_4_3_pre6
Changes since 1.3: +2 -0 lines
Log Message:
remove dir at the end of cleanup

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 spiga 1.3 msg+='planned for CRAB_2_5_0'
48 spiga 1.2 common.logger.message(msg)
49 slacapra 1.4 common.work_space.delete()
50     print 'directory '+common.work_space.topDir()+' removed'