Hi Chris,
I am implementing a scheduled events to send regular pulses between Mworks and OE. Currently the cancel flag for the events is set to 1 at the exist system state of the task. This works for most of the times, however, sometimes it does not set to 1 when I stop the program and this causes Server to crash. I was wondering if there is a way to get around this problem.
Thanks,
Eghbal
Hi Eghbal,
As I’ve noted before, the fact that scheduled actions don’t stop automatically when the experiment stops is a bug that needs to be fixed. I will try to get that fix in to the nightly build soon.
As a more general-purpose solution to this sort of problem, we could provide a mechanism to register actions that always execute when an experiment terminates, irrespective of why it terminates (i.e. normal termination or explicit stop). This is a feature that has been on my to-do list for a while, but I haven’t gotten to it yet.
In the meantime, the attached example demonstrates a method you can use to ensure that scheduled actions are canceled when the experiment stops. The key part is the run_python_string
action at the end of the scheduled action list, which queries the system variable #state_system_mode
(normally not accessible to experiments) and cancels the actions if the experiment is stopping or stopped. To use this in your own experiments, you’ll need to change the name cancel
in the Python code to whatever your cancellation variable is called.
Cheers,
Chris
Hi Eghbal,
the fact that scheduled actions don’t stop automatically when the experiment stops is a bug
This is fixed in the current nightly build.
Chris