dragon.globalservices.api_setup
API for managing the life-cycle of objects, such as processes and channels, through Global Services
Functions
|
Connect an externally-started process to the Dragon infrastructure. |
|
|
Disconnect an external process from Dragon infrastructure. |
|
|
Posts a message to GS and gets the response in a thread safe way |
|
|
|
|
|
- gs_request(req_msg, *, expecting_response=True)[source]
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
- test_connection_override(test_gs_input=None, test_gs_return=None, test_gs_return_cuid=None, test_ls_input=None, test_ls_return=None, test_ls_return_cuid=None)[source]
- connect_as_external(params)[source]
Connect an externally-started process to the Dragon infrastructure.
This function is for processes that were not spawned by Dragon but have registered with Global Services via attach(). It installs the launch parameters, attaches the default memory pool, and connects the four infrastructure channels. Unlike connect_to_infrastructure() it does NOT perform the GSPingProc handshake because external processes skip that step.
- Parameters:
params – LaunchParameters built by LaunchParameters.from_attach_info().