The OEO provides a method for user scripts running in an experiment node to pass messages to the OEO Console that will be displayed for an Operator (or Experimenter in development mode while wearing the Operator hat) to see. This service is accessible at http://192.168.32.25:12435/oeo_msg/....
To post a message from a bash script to the OEO Console, use an HTTP POST:
curl -X POST http://${AP_EXPENV_OEOCVM_XM:-192.168.32.25}:12435/oeo_msg/PUT_SEVERITY_HERE/PUT_URL_SAFE_BASE64_ENCODED_MESSAGE_HERE
The severity can be one of:
INFO
WARNING
ERROR
CRITICAL
The message to be posted to the OEO Console should be a utf-8 message that has been converted to URL-safe base64 (+ becomes -, / becomes _, =s are truncated). This method of encoding was chosen to avoid limitations provided by URL encoding, while also allowing for easy conversion (natively supported by most scripting languages).
Some tools for converting to base64:
NOTE: the OEO Console is used by operators to monitor the state of experiments. Many messages of various priorities are sent to the console with the expectation that an operator has a reasonable amount of time to read all of them. Please do not post a large number of messages to the console in a short period of time, and make sure to use a reasonable severity to aid in message filtering during debugging.
An example of posting a message to the OEO Console from a Python user script is below:
import requests
import base64
import os
def post_message(severity: str, message: str):
if severity not in ["INFO", "WARNING", "ERROR", "CRITICAL"]:
raise Exception("severity provided not supported")
message_encoded = base64.urlsafe_b64encode(message.encode('utf-8'))
oeo_ip = os.getenv("AP_EXPENV_OEOCVM_XM", "192.168.32.25")
requests.post(f"http://{oeo_ip}:12435/oeo_msg/{severity}/{message_encoded.decode('utf-8')}")
post_message("INFO", "hi from an experimenter script!")
from aerpawlib import AERPAW_Platform
aerpawlib.AERPAW_Platform.log_to_oeo("hi from an experimenter script!", "INFO")
The OEO system also provides a way for experimenters to pass values that can be seen in the OEO-CONSOLE in the table of values. This API is accessed in a very similar way to the message passing API, and is available on the "oeo_pub" endpoint (as opposed to the "oeo_msg" endpoint.
To update a value in the console from a bash script to the OEO Console, use an HTTP POST:
curl -X POST http://${AP_EXPENV_OEOCVM_XM:-192.168.32.25}:12435/oeo_pub/URLSAFE_ENCODED_TOPIC/URLSAFE_ENCODED_VALUE
Additionally, you can add a final field at the end of the request ("/URLSAFE_ENCODED_NODE_ID") that will specify a node that the incoming data/topic is assigned to.
The below examples show how to publish a value that can be viewed in the OEO-CONSOLE by running "add user/radio_stats/snr".
import requests
import base64
import os
def publish_value(value, topic: str, agent: str):
value_b64 = base64.urlsafe_b64encode(str(value).encode('utf-8')).decode('utf-8')
topic_b64 = base64.urlsafe_b64encode(str(topic).encode('utf-8')).decode('utf-8')
agent_b64 = base64.urlsafe_b64encode(str(agent).encode('utf-8')).decode('utf-8')
oeo_ip = os.getenv("AP_EXPENV_OEOCVM_XM", "192.168.32.25")
requests.post(f"http://{oeo_ip}:12435/oeo_pub/{topic_b64}/{value_b64}/{agent_b64}")
publish_value(15.67, "radio_stats/snr", "radio_script")
from aerpawlib import AERPAW_Platform
AERPAW_Platform.publish_user_oeo_topic(15.67, topic="radio_stats/snr", agent_id="radio_script")