ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/StatusServer.py
Revision: 1.41
Committed: Tue Nov 11 13:53:32 2008 UTC (16 years, 5 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_4_3_pre2, CRAB_2_4_3_pre1, CRAB_2_4_2
Changes since 1.40: +2 -2 lines
Log Message:
added support to avoid print on screen while querying task status

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.41 def query(self,display=True):
27 spiga 1.1
28 spiga 1.31 self.resynchClientSide()
29    
30     upTask = common._db.getTask()
31 spiga 1.41 self.compute(upTask,display)
32 spiga 1.31
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 mcinquil 1.40 common.logger.debug(1, str(e))
52 farinafa 1.37 common.logger.debug(1, traceback.format_exc() )
53 spiga 1.35 return
54    
55     try:
56 farinafa 1.37 reportList = minidom.parseString(reportXML).getElementsByTagName('Job')
57 farinafa 1.34 common._db.deserXmlStatus(reportList)
58     except Exception, e:
59 spiga 1.36 common.logger.debug(1,"WARNING: Problem while retrieving fresh status from the server.")
60 mcinquil 1.40 common.logger.debug(1, str(e))
61     common.logger.debug(1, traceback.format_exc() )
62 farinafa 1.34 return
63 spiga 1.35
64 spiga 1.31 return
65 mcinquil 1.2