oasislmf.utils.ping

Functions

oasis_ping(data)

Sends a JSON message to either a websocket server or a socket server.

oasis_ping_socket(target, data)

Sends a JSON message to a target socket

oasis_ping_websocket(ws_url, data)

Sends a JSON message to a target websocket

Module Contents

oasislmf.utils.ping.oasis_ping(data)[source]

Sends a JSON message to either a websocket server or a socket server.

If analysis_pk is in the data, OASIS_WEBSOCKET_URL and OASIS_WEBSOCKET_URL are in environment, sends a websocket message. If analysis_pk but missing variables, no message sent. Else, websocket sent to OASIS_SOCKET_SERVER_IP OASIS_SOCKET_SERVER_PORT defaulted to 127.0.0.1 8888.

For a specific socket or websocket, use oasis_ping_socket or oasis_ping_websocket with the target location.

Args:

data (dict): dictionary of data: JSON serialisable

Returns:

Boolean: whether attempted call gets through

oasislmf.utils.ping.oasis_ping_socket(target, data)[source]

Sends a JSON message to a target socket

Args:

target ((str, int)): IP and port to hit data (str): JSON dumped string

Returns:

Boolean: whether attempted call gets through

oasislmf.utils.ping.oasis_ping_websocket(ws_url, data)[source]

Sends a JSON message to a target websocket

Args:

ws_url (str): URL to hit (e.g. “ws://oasis-websocket:8001/ws/analysis-status/”) data (str): JSON dumped string

Returns:

Boolean: whether attempted call gets through