When you call mqs.execute(...,wait=True), the TDL script will pause and wait for the request to end executing, and for a result to come back. The browser will remain unresponsive during this time (since there's only one thread of execution, and it's hanging around inside mqs.execute() waiting for the tree to finish).
When you use wait=False, the TDL script issues a request to the node and moves on. If you issue multiple execute's without waiting, they will be queued up on the kernel side and executed in turn. In the meantime, your TDL job will finish, and the browser will remain responsive. This is usually what people want, so we tend to use wait=False in most places.
There's one situation when wait=True may be desirable --- if you really need the request to finish before doing something else, such as:
getting or changing node state in between different request
exiting a batch-mode or pipelined script
I recommend using the following pattern. Give all your TDL jobs an optional wait=False argument, and pass it on to mqs.execute():
-
1 def _tdl_job_do_something (mqs,parent,wait=False,**kwargs) 2 # ... 3 mqs.execute(node,request,wait=wait);
When called from the browser, wait will be False (since the browser does not pass any extra arguments). If you later need to call your script in batch mode, you can supply wait=True as needed.
