1 |
import apmon
|
2 |
|
3 |
class ApmonIf:
|
4 |
"""
|
5 |
Provides an interface to the Monalisa Apmon python module
|
6 |
"""
|
7 |
def __init__(self, address='http://monalisa.cern.ch/ARDA/apmon.cms'):
|
8 |
self._params = {}
|
9 |
self._MLaddress = address
|
10 |
self.apm = None
|
11 |
self.apm = self.getApmonInstance()
|
12 |
|
13 |
def fillDict(self, parr):
|
14 |
"""
|
15 |
Used to fill the dictionary of key/value pair and instantiate the ML client
|
16 |
"""
|
17 |
self._params = parr
|
18 |
|
19 |
def sendToML(self):
|
20 |
self.apm.sendParameters(self._params['taskId'], self._params['jobId'], self._params)
|
21 |
|
22 |
def getApmonInstance(self):
|
23 |
if self.apm is None :
|
24 |
apmonUrl = 'http://www-asap.cern.ch/ml-conf/apmon.cms'
|
25 |
print "Creating ApMon with " + apmonUrl
|
26 |
apmonInstance = apmon.ApMon(apmonUrl)
|
27 |
return apmonInstance
|