ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/ApmonIf.py
Revision: 1.8
Committed: Mon Apr 3 08:58:22 2006 UTC (19 years, 1 month ago) by corvo
Content type: text/x-python
Branch: MAIN
Changes since 1.7: +11 -6 lines
Log Message:
New configuration for apmon instances

File Contents

# Content
1 import apmon, sys, common
2
3 class ApmonIf:
4 """
5 Provides an interface to the Monalisa Apmon python module
6 """
7 def __init__(self, address='http://lxgate35.cern.ch:40808/ApMonConf'):
8 self._params = {}
9 self.fName = 'mlCommonInfo'
10 self._MLaddress = address
11 self.apm = None
12 self.apm = self.getApmonInstance()
13
14 def fillDict(self, parr):
15 """
16 Used to fill the dictionary of key/value pair and instantiate the ML client
17 """
18 self._params = parr
19
20 def sendToML(self):
21 self.apm.sendParameters(self._params['taskId'], self._params['jobId'], self._params)
22
23 def getApmonInstance(self):
24 if self.apm is None :
25 try:
26 apmonUrls = ["http://lxgate35.cern.ch:40808/ApMonConf", "http://monalisa.cacr.caltech.edu:40808/ApMonConf"]
27 apmInstance = apmon.ApMon(apmonUrls, apmon.Logger.FATAL);
28 if not apmInstance.initializedOK():
29 print "It seems that ApMon cannot read its configuration. Setting the default destination"
30 apmInstance.setDestinations({'lxgate35.cern.ch:58884': {'sys_monitoring':0, 'general_info':0, 'job_monitoring':1, 'job_interval':300}});
31 except:
32 exctype, value = sys.exc_info()[:2]
33 print "ApmonIf::getApmonInstance Exception raised %s Value: %s"%(exctype, value)
34 common.logger.message("ApmonIf::getApmonInstance Exception raised: %s %s"%(exctype, value))
35 return
36 return apmInstance
37
38 def free(self):
39 self.apm.free()