Ticket #2548 (closed: fixed)
Opening an algo dialog while running python crashes Mantid
Reported by: | Mathieu Doucet | Owned by: | Mathieu Doucet |
---|---|---|---|
Priority: | major | Milestone: | Iteration 28 |
Component: | MantidPlot | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Michael Whitty |
Description
Opening an algo dialog while running python algorithms crashes Mantid. A refreshAlgorithms() call is made when an algo is clicked. That call reload the python algorithm scripts (but will not update the algorithm call signature since those are set in mantidsimple when MantidPlot first starts).
Simple python script will set an is_running flag that will prevent the python algorithms from reloading. If python code returns but stays active, like when a python GUI is started, the is_running flag will be set to false so that calling refreshAlgorithms() will crash MantidPlot.
The following should be done:
- remove the refreshAlgorithms() call from ApplicationWindow::setScriptingLanguage. It's useless since the same call is made before all python scripts are run. It would only be useful if we could update the call signatures.
- add a python function to set the is_running flag. That way any process that lives past the script execution can set the is_running flag. Note that depending on where the call is made, there will always be a theoretical possibility of having the user click an algo dialog before the call is made and is_running is off.
- even with the new function described above, it would be too easy even for a developer to do the wrong thing and give the users a bad experience. We should put the refresh call, which is mostly useful for developers, as an option in Mantid.properties. The default should be OFF.
Change History
comment:7 Changed 10 years ago by Mathieu Doucet
Note that with the refresh ON, if you run another python algo while another python algo is running, you will reset the is_running flag so that if you run yet a third algo while the first is still running you will seg fault.
comment:9 Changed 10 years ago by Mathieu Doucet
This should now work. If you start an python algo dialog that runs for a long time (running EQSANS reduction from the UI will do the trick), running SNS powder diffraction reduction too). You can now pop up dialogs for other algo without set faulting. To enable run-time refresh of python algorithm (and void your warranty...), set
pythonalgorithms.refresh.allowed = 0
in your properties file. If you do and run long scripts, you should protect yourself by using
qti.app.mantidUI.setIsRunning(True)
when your script starts and
qti.app.mantidUI.setIsRunning(False)
at the end of it.
comment:10 Changed 10 years ago by Mathieu Doucet
- Status changed from accepted to verify
- Resolution set to fixed
comment:11 Changed 10 years ago by Mathieu Doucet
comment:12 Changed 9 years ago by Michael Whitty
- Status changed from verify to verifying
- Tester set to Michael Whitty
comment:14 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 3395
I'll be commenting the refresh call from the first point above so we remember to uncomment it if we get rid of mantidsimple.