ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Cleaner.py
Revision: 1.7
Committed: Tue May 15 09:09:13 2007 UTC (17 years, 11 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_1_2, CRAB_2_1_2_pre2, CRAB_2_1_2_pre1, CRAB_2_1_1, CRAB_2_1_1_pre3, CRAB_2_2_0_pre1, CRAB_2_1_1_pre1, CRAB_2_1_0, CRAB_2_1_0_pre6, CRAB_2_1_0_pre5, CRAB_2_1_0_pre4, CRAB_2_1_0_pre3, CRAB_2_1_0_pre2, CRAB_2_1_0_pre1, CRAB_2_0_4, CRAB_2_0_4_pre2, CRAB_2_0_4_pre1, CRAB_2_0_3, CRAB_2_0_3_pre1, CRAB_2_0_2, CRAB_2_0_2_pre6, CRAB_2_0_2_pre5, CRAB_2_0_2_pre4, CRAB_2_0_2_pre3, CRAB_1_5_4_SLC3, CRAB_1_5_4_SLC3_pre4, CRAB_2_0_2_pre2, CRAB_2_0_2_pre1, CRAB_1_5_4_SLC3_pre3, CRAB_2_0_1, CRAB_1_5_4_SLC3_pre2, CRAB_2_0_1_pre1, CRAB_1_5_4_SLC3_pre1, CRAB_2_0_0, CRAB_2_0_0_pre10, CRAB_2_0_0_pre9, CRAB_1_5_4, CRAB_1_5_4_pre2, CRAB_1_5_4_pre1, CRAB_2_0_0_pre7, CRAB_2_0_0_pre6, CRAB_1_5_3, CRAB_1_5_3_pre5, CRAB_1_5_3_pre4, CRAB_2_0_0_pre5, CRAB_1_5_3_pre3, configure, CRAB_2_0_0_pre4, CRAB_1_5_3_pre2, CRAB_1_5_3_pre1, CRAB_2_0_0_pre3, CRAB_1_5_2, CRAB_2_0_0_pre2, CRAB_2_0_0_pre1, CRAB_1_5_1, CRAB_1_5_1_pre4, CRAB_1_5_1_pre3, CRAB_1_5_1_pre2
Branch point for: CRAB_2_1_2_br, CRAB_2_1_1_pre2, CRAB_1_5_4_SLC3_pre4_br, CRAB_1_5_4_SLC3_start
Changes since 1.6: +5 -4 lines
Log Message:
fix double free problem in -clean: need boss >= BOSS_4_3_3-sl3-sl4-pre2. Cleaner is now an Actor

File Contents

# User Rev Content
1 slacapra 1.7 from Actor import *
2 slacapra 1.1 from crab_exceptions import *
3     from crab_logger import Logger
4     from StatusBoss import StatusBoss
5     from Status import Status
6     import common
7 slacapra 1.6 import string
8 slacapra 1.1
9 slacapra 1.7 class Cleaner(Actor):
10 slacapra 1.5 def __init__(self, cfg_params):
11 slacapra 1.1 """
12     constructor
13     """
14 slacapra 1.5 self.status = StatusBoss(cfg_params)
15 slacapra 1.1
16     def check(self):
17     """
18     Check whether no job is still running or not yet retrieved
19     """
20    
21     self.status.compute() # compute the status
22    
23     ## SL: What a ugly interface (I use here). I should try a dictionary or something similar...
24 slacapra 1.4 (ToTjob,countCreated,countReady,countSche,countRun,countCleared,countAbort,countCancel,countDone) = self.status.status()
25 slacapra 1.1
26     JobsOnGrid = countRun+countSche+countReady # job still on the grid
27     if JobsOnGrid or countDone:
28     msg = "There are still "
29     if JobsOnGrid:
30     msg= msg+str(JobsOnGrid)+" jobs submitted. Kill them '-kill' before '-clean'"
31     if (JobsOnGrid and countDone):
32     msg = msg + "and \nalso"
33     if countDone:
34     msg= msg+str(countDone)+" jobs Done. Get their outputs '-getoutput' before '-clean'"
35     raise CrabException(msg)
36    
37     pass
38    
39 slacapra 1.7 def run(self):
40 slacapra 1.1 """
41     remove all
42     """
43 slacapra 1.2 if common.jobDB.nJobs()>0:
44     self.check()
45    
46 slacapra 1.1 # here I should first purge boss DB if central
47 slacapra 1.7 common.scheduler.clean()
48     common.work_space.delete()
49 slacapra 1.1 print 'directory '+common.work_space.topDir()+' removed'