ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/CleanerServer.py
(Generate patch)

Comparing COMP/CRAB/python/CleanerServer.py (file contents):
Revision 1.6 by spiga, Tue May 26 10:23:00 2009 UTC vs.
Revision 1.10 by farinafa, Wed Aug 26 12:57:22 2009 UTC

# Line 1 | Line 1
1   from Actor import *
2   from crab_exceptions import *
3 + from crab_util import *
4   import common
5   import string
6 + from ServerCommunicator import ServerCommunicator
7 + from StatusServer import StatusServer
8 + from Cleaner import Cleaner
9 +
10 + class CleanerServer(Cleaner):
11  
6 class CleanerServer(Actor):
12      def __init__(self, cfg_params):
13          """
14          constructor
15          """
16 +        Cleaner.__init__(self, cfg_params)
17          self.cfg_params = cfg_params
18  
19 <    def check(self):
20 <        """
21 <        Check whether no job is still running or not yet retrieved
22 <        """
23 <        # get updated status from server
19 >        # init client server params...
20 >        CliServerParams(self)
21 >        return
22 >
23 >    def run(self):
24 >        # get updated status from server
25          try:
19            from StatusServer import StatusServer
26              stat = StatusServer(self.cfg_params)
27              stat.resynchClientSide()
28          except:
29              pass
30 +        
31 +        # check whether the action is allowable
32 +        self.check()
33  
34 <    def run(self):
35 <        """
36 <        remove all
34 >        # notify the server to clean the task
35 >        csCommunicator = ServerCommunicator(self.server_name, self.server_port, self.cfg_params)
36 >        taskuuid = str(common._db.queryTask('name'))
37 >
38 >        try:
39 >            csCommunicator.cleanTask(taskuuid)
40 >        except Exception, e:
41 >            msg = "Client Server comunication failed about cleanJobs: task \n" + taskuuid
42 >            msg += "Only local working directory will be removed."
43 >            common.logger.debug( msg)
44 >            pass
45  
46 <        if common.jobDB.nJobs()>0:
47 <            self.check()
46 >        # TODO remove these lines once the integration completed
47 >        msg=''
48 >        msg+='functionality not yet available for the server. Work in progres \n'
49 >        msg+='only local working directory will be removed'
50 >        common.logger.info(msg)
51 >        # TODO - end
52  
53 <        countEnded = 0
33 <        for nj in range(common.jobDB.nJobs()):
34 <            if common.jobDB.status(nj) in ['Y','K', 'A', 'C']:
35 <                countEnded += 1
36 <        if countEnded == common.jobDB.nJobs():
37 <            tempWorkSpace = common.work_space.topDir()
38 <            common.scheduler.clean()
39 <            common.work_space.delete()
40 <            print ( 'crab. directory '+tempWorkSpace+' removed' )
41 <        else:
42 <            common.logger.info ( 'Impossible to remove: not all jobs are yet finished\n      (you maight kill these jobs and then clean the task)')
43 <        """
44 <        msg=''  
45 <        msg+='functionality not yet available for the server. Work in progres \n'
46 <        msg+='only local worling directory will be removed'
47 <        #msg+='planned for CRAB_2_5_0'
48 <        common.logger.info(msg)
53 >        # remove local structures
54          common.work_space.delete()
55          print 'directory '+common.work_space.topDir()+' removed'
56 +        return
57 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines