Hi all,
I have two questions regarding runmanager remote API:
1. Can I create new globals using the API? I know that I can set the value of existing globals but could not find how I can create new globals.
2. How do I make the engage function of the runmanager API blocking? What I mean is the following. Consider a list of experiments where for every experiment a new "Experiment.py" file has to be generated, the values of globals are set and then we start the compilation by executing engage. Here is a dummy code.
################_start_################
exp_list=[exp_1, exp_2, exp_3]
for exp in exp_list:
generate_exp_script()
set_values_of_globals()
remoteClient.engage() #remoteClient is runmanager object as defined in the API usage
################_end_################
I wanted to check if this code would wait for "remoteClient.engage()" to finish generating HDF files for all shots of exp_1 before proceeding to exp_2 in the loop? My experience tells me its does not. This is clear if I look into the script inside the HDFs for different shots. They are inconsistent with what I expect. However if I put a long enought wait time after the engage statement in the loop (by writing "time.sleep(10 or 20 etc...)") then all HDFs have correct script in them.
My explanation for this is that the "remoteClient.engage()" is not blocking. So after it executed in the loop for the first time a thread got launched which does the compilation. But the program has already moved to exp_2 in the loop and so has changed the "Experiment.py" file. Since the thread launched in the first iteration might still be running, it will now pack this wrong "Experiment.py" file into the shots of exp_1. And since exp_1 and exp_2 can have very different contents I need to make sure that the loop actually waits for the compilation of exp_1 to finish before moving to exp_2 and so on..
For now I just put in a wait by hand but I was wondering if there is a better alternative??
Regards,
Rohit Prasad Bhatt