ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Cleaner.py
Revision: 1.5
Committed: Thu Sep 21 15:48:26 2006 UTC (18 years, 7 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_1_5_0_pre3, CRAB_1_5_0_pre2, CRAB_1_4_2, CRAB_1_5_0_pre1, CRAB_1_4_1, CRAB_1_4_1_pre2, CRAB_1_4_1_pre1, CRAB_1_4_0, CRAB_1_4_0_pre4, CRAB_1_4_0_pre3, CRAB_1_4_0_pre2, CRAB_1_4_0_pre1, CRAB_1_3_0, CRAB_1_3_0_pre6, CRAB_1_3_0_pre5, CRAB_1_3_0_pre4, CRAB_1_3_0_pre3
Branch point for: branch_1_4_1
Changes since 1.4: +2 -5 lines
Log Message:
more mode for merging with boss4 branch

File Contents

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