ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/CleanerServer.py
Revision: 1.9
Committed: Tue Aug 25 11:56:52 2009 UTC (15 years, 8 months ago) by farinafa
Content type: text/x-python
Branch: MAIN
Changes since 1.8: +3 -1 lines
Log Message:
Fix on CleanerServer import

File Contents

# User Rev Content
1 mcinquil 1.1 from Actor import *
2     from crab_exceptions import *
3     import common
4     import string
5 farinafa 1.7 from ServerCommunicator import ServerCommunicator
6     from StatusServer import StatusServer
7 farinafa 1.9 from Cleaner import Cleaner
8 farinafa 1.7
9     class CleanerServer(Cleaner):
10 mcinquil 1.1
11     def __init__(self, cfg_params):
12     """
13     constructor
14     """
15 farinafa 1.7 Cleaner.__init__(self, cfg_params)
16 mcinquil 1.1 self.cfg_params = cfg_params
17    
18 farinafa 1.7 # init client server params...
19     CliServerParams(self)
20     return
21    
22     def run(self):
23     # get updated status from server
24 spiga 1.3 try:
25     stat = StatusServer(self.cfg_params)
26     stat.resynchClientSide()
27     except:
28     pass
29 farinafa 1.7
30     # check whether the action is allowable
31     Cleaner.check()
32 mcinquil 1.1
33 farinafa 1.7 # notify the server to clean the task
34     csCommunicator = ServerCommunicator(self.server_name, self.server_port, self.cfg_params)
35     taskuuid = str(common._db.queryTask('name'))
36 spiga 1.2
37 farinafa 1.7 try:
38     csCommunicator.cleanTask(taskuuid)
39     except Exception, e:
40 farinafa 1.9 msg = "Client Server comunication failed about cleanJobs: task \n" + taskuuid
41     msg += "Only local working directory will be removed."
42 farinafa 1.7 common.logger.debug( msg)
43     pass
44 mcinquil 1.1
45 farinafa 1.8 # TODO remove these lines once the integration completed
46     msg=''
47     msg+='functionality not yet available for the server. Work in progres \n'
48     msg+='only local working directory will be removed'
49     common.logger.info(msg)
50     # TODO - end
51    
52 farinafa 1.7 # remove local structures
53 slacapra 1.4 common.work_space.delete()
54     print 'directory '+common.work_space.topDir()+' removed'
55 farinafa 1.7 return
56