dragon.globalservices.api_setup

Setup and global objects for Dragon’s GS client API.

This module includes initialization code for getting handles to and from the local shepherd and global services through which API generated messages are sent.

Python thread locks are provided here so that threaded Python clients can have more than one transaction outstanding to GS at once.

Functions

connect_to_infrastructure([force])

get_gs_ret_cuid()

gs_request(req_msg, *[, expecting_response])

Posts a message to GS and gets the response in a thread safe way

load_launch_parameter(name)

next_tag()

test_connection_override([test_gs_input, ...])

gs_request(req_msg, *, expecting_response=True)

Posts a message to GS and gets the response in a thread safe way

This is an attempt to make global services transactions blocking and thread safe while avoiding needless head of queue blocking - we don’t want there to be only one transaction outstanding at a time because it might take a long time to finish and block other threads’ transactions in the meantime, but without starting a separate dedicated thread simply to deal and service gs transactions. The implementation here tries to solve this without involving a new thread at all, but that might not be the best way to do it; a separate service thread would probably be simpler.

The overhead of doing this stuff if only one thread is ever involved means acquiring a couple locks that have no contention on them and constructing an event variable which means another lock.

Arguments:
param req_msg

request message to send.

param expecting_response

Bool default True, is a response message expected?

Returns:

the reply to the request message