ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/StatusServer.py
Revision: 1.46
Committed: Thu Oct 1 14:53:30 2009 UTC (15 years, 7 months ago) by mcinquil
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_7_1_pre11, CRAB_2_7_1_pre10, CRAB_2_7_1_pre9, CRAB_LumiMask, CRAB_2_7_lumi, from_LimiMask, CRAB_2_7_1_pre8, CRAB_2_7_1_pre6, CRAB_2_7_1_pre5, CRAB_2_7_1_wmbs_pre4, CRAB_2_7_1_pre4, CRAB_2_7_1_pre3, CRAB_2_7_1_pre2, CRAB_2_7_1_pre1, CRAB_2_7_0, CRAB_2_7_0_pre8, CRAB_2_7_0_pre7, CRAB_2_7_0_pre6, CRAB_2_7_0_pre5, CRAB_2_7_0_pre4, CRAB_2_7_0_pre3
Branch point for: CRAB_2_7_1_branch, Lumi2_8
Changes since 1.45: +3 -0 lines
Log Message:
printing warning message when problems with xml

File Contents

# Content
1 from Actor import *
2 from crab_util import *
3 import common
4 from ApmonIf import ApmonIf
5 import time
6
7 import traceback
8 from xml.dom import minidom
9 from ServerCommunicator import ServerCommunicator
10 from Status import Status
11
12 from xml.parsers.expat import *
13
14 import zlib
15 import base64
16
17 class StatusServer(Status):
18
19 def __init__(self, *args):
20
21 Status.__init__(self, *args)
22
23 # init client server params...
24 CliServerParams(self)
25
26 return
27
28 def query(self,display=True):
29
30 self.resynchClientSide()
31
32 upTask = common._db.getTask()
33 self.compute(upTask,display)
34
35 def resynchClientSide(self):
36 """
37 get status from the server and
38 aling back data on client
39 """
40 task = common._db.getTask()
41 self.task_unique_name = str(task['name'])
42
43 # communicator allocation
44 csCommunicator = ServerCommunicator(self.server_name, self.server_port, self.cfg_params)
45 handledXML = csCommunicator.getStatus( self.task_unique_name )
46 del csCommunicator
47
48 # align back data and print
49 reportXML = None
50 try:
51 handledXML += "="*( len(handledXML)%8 )
52 reportXML = zlib.decompress( base64.urlsafe_b64decode(handledXML) )
53 except Exception, e:
54 common.logger.info("WARNING: The status cache is out of date. Please issue crab -status again")
55 common.logger.debug("WARNING: Problem while decompressing fresh status from the server.")
56 common.logger.debug( str(e))
57 common.logger.debug( traceback.format_exc() )
58 return
59
60 try:
61 reportList = minidom.parseString(reportXML).getElementsByTagName('Job')
62 common._db.deserXmlStatus(reportList)
63 except ExpatError, experr:
64 common.logger.info("WARNING: The status cache is out of date. Please issue crab -status again")
65 common.logger.debug("ERROR: %s"%str(experr))
66 common.logger.debug( str(experr))
67 common.logger.debug( traceback.format_exc() )
68 # raise CrabException(str(experr))
69 except TypeError, e:
70 common.logger.info("WARNING: The status cache is out of date. Please issue crab -status again")
71 common.logger.debug("WARNING: Problem while retrieving fresh status from the server.")
72 common.logger.debug( str(e))
73 common.logger.debug( traceback.format_exc() )
74 return
75
76 return
77
78 def showWebMon(self):
79 msg = 'You can also check jobs status at: http://%s:8888/logginfo\n'%self.server_name
80 msg += '\t( Your task name is: %s )\n'%common._db.queryTask('name')
81 common.logger.debug(msg)
82 #common.logger.info("Web status at: http://%s:8888/visualog/?taskname=%s&logtype=Status\n"%(self.server_name,self.task_unique_name))