Hello Michael,
I have installed carchivetools and it looks like is will do exactly what I need but I think I am having a problem connecting it to AA. I am using twistd (the Twisted daemon) 13.2.0 and Python 2.7.6. I compiled and installed using setup.py
and installed it under su. It all went smoothly and twistd –help now shows a2aproxy
The problem is when I query a2aproxy with archiver.names or values (anything that seems to connect to AA). a2aproxy will crashes with an exception 'dict' object has no attribute 'getint'. All the gory details follow...
I have an archiver appliance running on localhost. The mgmt and retrieval urls are running on different ports but I believe that is normal for the full setup of AA. From a browser,
http://localhost:17665/mgmt/bpl/getApplianceInfo,
AA will return:
{"engineURL":"http:\/\/localhost:17666\/engine\/bpl","identity":"appliance0","retrievalURL":"http:\/\/localhost:17668\/retrieval\/bpl","clusterInetPort":"localhost:16670","etlURL":"http:\/\/localhost:17667\/etl\/bpl","version":"Archiver
Appliance Version 0.0.1_SNAPSHOT_13-May-2016T11-23-57","mgmtURL":"http:\/\/localhost:17665\/mgmt\/bpl","dataRetrievalURL":"http:\/\/localhost:17668\/retrieval"}
So, I start the a2aproxy via:
twistd -n a2aproxy -P 8888 -A localhost:17665 (and several combinations of this with http:// etc during testing)
If I start from outside the twisted plugin directory it will crash, this was my first worry as I thought that it was installed:
ImportError: No module named EPICSEvent_pb2
However, if I go into the twisted directory it will start. Ok, so I moved on, everything looks good. I can send and return the archiver.info call and get the hardcoded response from the proxy.
However, if I send:
archiver.names(1,"rga")
Instead of getting a list of matching PVs from the AA it crashed with:
2016-07-26 13:53:40+0100 [HTTPChannel,0,148.79.212.92] INFO:carchive.a2aproxy.resource Request: archiver.names(1, 'rga')
2016-07-26 13:53:40+0100 [HTTPChannel,0,148.79.212.92] WARNING:carchive.a2aproxy.resource Cleanup of request with no reply
2016-07-26 13:53:40+0100 [HTTPChannel,0,148.79.212.92] 148.79.212.92 - - [26/Jul/2016:12:53:39 +0000] "POST /cgi-bin/ArchiveDataServer.cgi HTTP/1.1" 500 - "-" "Python-xmlrpc/3.5"
2016-07-26 13:53:40+0100 [HTTPChannel,0,148.79.212.92] ERROR:carchive.a2aproxy.resource Unhandled execption during request: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/web/resource.py", line 250, in render
return m(request)
File "/usr/local/lib/python2.7/dist-packages/carchive/a2aproxy/resource.py", line 106, in render_POST
Dinfo = self.fetchInfo()
File "/usr/local/lib/python2.7/dist-packages/carchive/a2aproxy/resource.py", line 73, in fetchInfo
D = getArchive({'url':self.infourl})
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1237, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1099, in _inlineCallbacks
result = g.send(result)
File "/usr/local/lib/python2.7/dist-packages/carchive/backend/appl.py", line 208, in getArchive
maxRequests=conf.getint('maxrequests', 100))
exceptions.AttributeError: 'dict' object has no attribute 'getint'
So, I thought that maybe the AA address was not getting set correctly in the proxy startup so I put a print statement into
./carchivetools-master/carchive/a2aproxy/resource.py:
def buildResource(infourl=None):
if not infourl.startswith('http') and infourl.find('/')==-1:
# only host:port is provided, use default URL
infourl = "http://%s/mgmt/bpl/getApplianceInfo"%infourl
C = DataServer()
C.infourl = infourl
print(infourl)
This printed out the correct url for AA:
http://localhost:17665/mgmt/bpl/getApplianceInfo
Best regards,
Rory