Heartbeat for Eikon API Proxy

Hi,

Sometimes I have found that the Eikon API proxy would become unresponsive, is there a recommended way to send a heartbeat through to Eikon API Proxy (embedded in Eikon Desktop?) Alternatively I could try get_data and catch any exceptions, however sometimes have found that get_data can fail due to non-responsiveness. Just looking for a simple way to check that API is ready and responsive.

Currently just checking if port 9000 is alive, wondering was there another way to check?

set_app_key doesnt raise any exceptions (only the fetching data functions do), just prints messages like below so believe can't catch exception without monkey patching the eikon library.

Timeout on checking port 36036
Error: no proxy address identified.
Check if Eikon Desktop or Eikon API Proxy is running.
Port number was not identified, cannot send any request

Best Answer

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    Answer ✓

    There's no recommended way to do this. Personally I don't quite see the point. If you determine that API Proxy is not responding to the heartbeat, what are you going to do? And why wouldn't you do the same thing when the request fails. What's the advantage of dealing with the failed heartbeat over dealing with a failed request? I only see disadvantages: when the request fails you know you have a problem, and the problem is you didn't get the data you need. So you must deal with this problem. When a heartbeat fails it's quite possibly a temporary issue that may remedy itself by the time you need to send your data requests. What could be the reason for API Proxy process to stop listening on the local port? A process is starved of resources perhaps? Or the process is hung. Either way I don't see why you'd want to know about it and deal with it before you need to retrieve the data.
    You're right, set_app_key doesn't raise an exception, it outputs messages to the logger named pyeikon. You can capture messages created by a Python logger by adding a handler to the logger. Here's an example you can easily adapt for your purposes: http://alanwsmith.com/capturing-python-log-output-in-a-variable
    This way you could use set_app_key method as your heartbeat, but as I said, I don't quite see the point.

Answers