ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/StatusServer.py
Revision: 1.38
Committed: Sat Apr 26 08:25:00 2008 UTC (17 years ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_1_pre3, CRAB_2_2_1_pre2, CRAB_2_2_1_pre1, CRAB_2_2_0, CRAB_2_2_0_pre21, CRAB_2_2_0_pre19, CRAB_2_2_0_pre18, CRAB_2_2_0_pre17, CRAB_2_2_0_pre16, CRAB_2_2_0_pre15, CRAB_2_2_0_pre13
Changes since 1.37: +5 -22 lines
Log Message:
Correct proxy management....not safe to check it everywhere. Added support for caf (e.g. local ) server. Code reorganization..

File Contents

# User Rev Content
1 spiga 1.1 from Actor import *
2     from crab_util import *
3     import common
4     from ApmonIf import ApmonIf
5     import time
6    
7 farinafa 1.24 import traceback
8     from xml.dom import minidom
9     from ServerCommunicator import ServerCommunicator
10     from Status import Status
11    
12 spiga 1.35 import zlib
13     import base64
14    
15 farinafa 1.24 class StatusServer(Status):
16    
17     def __init__(self, *args):
18 spiga 1.38
19 spiga 1.36 Status.__init__(self, *args)
20 spiga 1.38
21     # init client server params...
22     CliServerParams(self)
23 farinafa 1.24
24 farinafa 1.27 return
25    
26 spiga 1.31 def query(self):
27 spiga 1.1
28 spiga 1.31 self.resynchClientSide()
29    
30     upTask = common._db.getTask()
31     self.compute(upTask)
32    
33 farinafa 1.27 def resynchClientSide(self):
34 spiga 1.31 """
35     get status from the server and
36     aling back data on client
37     """
38 farinafa 1.24 task = common._db.getTask()
39 spiga 1.28
40 farinafa 1.24 # communicator allocation
41 spiga 1.38 csCommunicator = ServerCommunicator(self.server_name, self.server_port, self.cfg_params)
42 spiga 1.35 handledXML = csCommunicator.getStatus( str(task['name']) )
43 farinafa 1.24 del csCommunicator
44    
45     # align back data and print
46 farinafa 1.34 try:
47 farinafa 1.37 handledXML += "="*( len(handledXML)%4 )
48     reportXML = zlib.decompress( base64.urlsafe_b64decode(handledXML) )
49 spiga 1.35 except Exception, e:
50 spiga 1.36 common.logger.debug(1,"WARNING: Problem while decompressing fresh status from the server.")
51 farinafa 1.37 common.logger.debug(1, traceback.format_exc() )
52 spiga 1.35 return
53    
54     try:
55 farinafa 1.37 reportList = minidom.parseString(reportXML).getElementsByTagName('Job')
56 farinafa 1.34 common._db.deserXmlStatus(reportList)
57     except Exception, e:
58 spiga 1.36 common.logger.debug(1,"WARNING: Problem while retrieving fresh status from the server.")
59 farinafa 1.34 return
60 spiga 1.35
61 spiga 1.31 return
62 mcinquil 1.2