ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Cleaner.py
Revision: 1.9
Committed: Fri Apr 11 14:54:22 2008 UTC (17 years ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_0_pre12, CRAB_2_2_0_pre11, CRAB_2_2_0_pre10, bp_osg_bdii, CRAB_2_2_0_pre9, CRAB_2_2_0_pre8, CRAB_2_2_0_pre7
Branch point for: osg_bdii
Changes since 1.8: +7 -8 lines
Log Message:
Many changes to have LSF working with BossLite
Introduce Killer class to handle -kill which works again
Work_space::res() return the correct output directory also in case user has set a non default one, Likewise for logDir()
USER.outputdir is not to be used anywhere outside workspace class
Some cleanup in submit logic, to reduce call of Scheduler specific classes from Submitter.py
crab -clean works as well (well, almost, still need to remove twice the directory)
Fill startDirectory and outputDirectory to Task
GetOuput check status and not schedulerStatus (not stantard)
Some cleanup in the use of BlackWhiteListParser
No explicit check of scheduler concrete type in Submitter at listMatch level: move different behaviour in SchedulerXYZ implementation
Plus other things I'm forgetting...

Stefano

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 Status import Status
5     import common
6 slacapra 1.6 import string
7 slacapra 1.1
8 slacapra 1.7 class Cleaner(Actor):
9 slacapra 1.5 def __init__(self, cfg_params):
10 slacapra 1.1 """
11     constructor
12     """
13 spiga 1.8 self.status = Status(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    
20     self.status.compute() # compute the status
21    
22 slacapra 1.9 countSub=common.bossSession.loadJobsByRunningAttr( { 'status' : 'S' })
23     countDone=common.bossSession.loadJobsByRunningAttr( { 'status' : 'SD' })
24 slacapra 1.1
25 slacapra 1.9 if countSub or countDone:
26 slacapra 1.1 msg = "There are still "
27 slacapra 1.9 if countSub:
28     msg= msg+str(countSub)+" jobs submitted. Kill them '-kill' before '-clean'"
29     if (countSub and countDone):
30 slacapra 1.1 msg = msg + "and \nalso"
31     if countDone:
32     msg= msg+str(countDone)+" jobs Done. Get their outputs '-getoutput' before '-clean'"
33     raise CrabException(msg)
34    
35     pass
36    
37 slacapra 1.7 def run(self):
38 slacapra 1.1 """
39     remove all
40     """
41 slacapra 1.9 if common._db.nJobs()>0:
42 slacapra 1.2 self.check()
43    
44 slacapra 1.1 # here I should first purge boss DB if central
45 slacapra 1.7 common.scheduler.clean()
46     common.work_space.delete()
47 slacapra 1.1 print 'directory '+common.work_space.topDir()+' removed'