add support for multiple Experiment() #89
Robustify multiples launches of researcher as reported in #89 (closed) #72 (closed) :
- in notebook
- in script
Supported scenario (tested with getting_started.py):
- multiple successive launch in notebook without a
clear output and restart
between launches : createExperiment()
,exp.run()
, createExperiment()
,exp.run()
, etc. (or relaunch without re-create) This scenario means multipleExperiment()
existing in a notebook - multiple
Experiment()
objects in a script: run a script that does createExperiment()
,exp.run()
, createExperiment()
,exp.run()
, etc. - launch in notebook, then launch a script
- launch a script, then launch a notebook
Scenario not intended to be supported by this branch:
- launch 2 nodes simultaneously with same node_id: not detected, may not work correctly
- launch 2 researcher simultaneously with same node_id: appears to work in simple cases, but probably needs robustification of message handling in researcher
Added in the branch:
- singleton for
Requests()
to avoid conflicting instances in same program - randomization of MQTT client ID done by broker (not Messaging)
- unique queue per
Requests()
instance to avoid conflict between several programs running for same {node,researcher}_id on a host - some basic error handling and error messages for communication layers
- also handles the case where 2 instances exist with same {node,researcher}_id: marginal for the finally retained scenario with random client_id (detect very rare case of random id conflict for MQTT connection), mandatory for alternative scenario (MQTT connection using the {node,researcher}_id as client_id)