ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/StatusServer.py
Revision: 1.39
Committed: Tue May 27 15:31:42 2008 UTC (16 years, 11 months ago) by farinafa
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_4_2_pre2, CRAB_2_4_2_pre1, CRAB_2_4_1, CRAB_2_4_1_pre4, CRAB_2_4_1_pre3, CRAB_2_4_1_pre2, CRAB_2_4_1_pre1, CRAB_2_4_0_Tutorial, CRAB_2_4_0_Tutorial_pre1, CRAB_2_4_0, CRAB_2_4_0_pre9, CRAB_2_4_0_pre8, CRAB_2_4_0_pre7, CRAB_2_4_0_pre6, CRAB_2_4_0_pre5, CRAB_2_4_0_pre4, CRAB_2_4_0_pre3, CRAB_2_4_0_pre2, CRAB_2_4_0_pre1, CRAB_DLS_PHED1, CRAB_DLS_PHED, CRAB_2_3_2_Fnal, CRAB_2_3_2, CRAB_2_3_2_pre7, CRAB_2_3_2_pre5, CRAB_2_3_2_pre4, CRAB_2_3_2_pre3, CRAB_2_3_2_pre2, CRAB_2_3_2_pre1, CRAB_2_4_0_test, CRAB_2_3_1, CRAB_2_3_1_pre6, CRAB_2_3_1_pre5, CRAB_2_3_1_pre4, CRAB_2_3_1_pre3, CRAB_2_3_1_pre2, CRAB_2_3_1_pre1, CRAB_2_3_0, CRAB_2_3_0_pre6, CRAB_2_3_0_pre1, CRAB_2_2_2_pre5, CRAB_2_2_2_pre4, CRAB_2_2_2_pre3, CRAB_2_2_2_pre2, CRAB_2_2_2_pre1, CRAB_2_2_1, CRAB_2_2_1_pre6, CRAB_2_2_1_pre5, CRAB_2_2_1_pre4, PRODCOMMON_0_10_7_testCS2
Branch point for: AnaDataSet, CRAB_2_3_0_br
Changes since 1.38: +1 -1 lines
Log Message:
Fix for the base64 padding mess

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.39 handledXML += "="*( len(handledXML)%8 )
48 farinafa 1.37 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