mdsplus
mdsplus copied to clipboard
Update documentation with currently supported scheduling mechanisms
There are multiple conflicting sources of information describing the available scheduling capabilities as of Jan 2022 (see example image snips below). I'm interested in knowing what scheduling types are actually supported and how to use them beyond the standard "sequential" scheduling method. Can the documentation be updated or a can you provide a link to some existing documentation that I have not found yet? Thank you.
The conditional/expression form of action dispatching was designed and implemented, at least in the C based dispatcher application. This feature was used by several experiments including the C-Mod experiment at MIT. The way this worked and I assume still works was that an action can use an expression which contains references to other action nodes in the tree. The dispatcher builds a table of action dependencies and will monitor the state of the actions and reevaluate the expressions of actions which include references to an action when that action completes. To help understand how this works lets imagine an scheduling expression of an action that looks like ACTION1 | (ACTION2 & ACTION3). This will cause this action to be dispatched if and when either ACTION1 completes successfully or both ACTION2 and ACTION3 complete successfully. If ACTION1 is turned off in the tree or either of ACTION2 or ACTION3 are turned off, this action will not be monitored and will not be executed. If you have a simple expression such as ~ACTION1 for example, this action will be dispatched only after ACTION1 is dispatched and fails.
I hope this helps. I do not know if the java based dispatched supports this feature or not. Sorry that this was never well documented on the web site. Perhaps one of the current MDSplus developers could add this documentation and probably do a better job of explaining how it works.
Following up on this, Conditional appears to not be supported in the python module. In the code, it looks like there is a 'type' keyword for the Dispatch object that can be used to change the dispatch type from default of 2 to 3 for conditional dispatching, but trying to use it causes errors. I worked to see if I could patch it to be functional but everything I tried ran into one problem or another. I think I was at my knowledge limit for the interface between python and the mdsplus core code.
>>> from MDSplus import Dispatch
>>> d = Dispatch("SERVER", "INIT", 50, None)
>>> d2 = Dispatch("SERVER", "INIT", 50, None, type=3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: __new__() got an unexpected keyword argument 'type'
>>> d3 = Dispatch(3, "SERVER", "INIT", 50, None)
>>> d.__dict__
{'opcode': 2, '_fields': {'ident': 0, 'phase': 1, 'when': 2, 'completion': 3}, '_argOffset': 4, '_descs': ['SERVER', 'INIT', 50, *]}
>>> d3.__dict__
{'opcode': 2, '_fields': {'ident': 0, 'phase': 1, 'when': 2, 'completion': 3}, '_argOffset': 4, '_descs': [3, 'SERVER', 'INIT', 50, *]}