Ticket #5006 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

Execute Python scripts in separate thread in MantidPlot

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: critical Milestone: Release 2.1
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Stuart Campbell

Description

The live data work requires that we have real asynchronous execution of scripts in MantidPlot not just the pseudo-asynchrnous behaviour we have at the moment.

Change History

comment:1 Changed 9 years ago by Martyn Gigg

  • Status changed from new to accepted

This requires a complete overhaul of how the GUI functions exposed to Python work. They will need to be reimplemented to ensure they only execute in the main GUI thread.

comment:2 Changed 9 years ago by Martyn Gigg

First cut at a python GUI fn working from diff thread. Refs #5006

Anything other than plotSpectrum will crash!

Changeset: 63f4a839a54ee826024f1c7fd18827e1d5a47b88

comment:3 Changed 9 years ago by Martyn Gigg

Reworked Script Window to isolate scripts from each other. Refs #5006

Changeset: 56e820d97f9bc1c20884da98c63a8de6b9948f81

comment:4 Changed 9 years ago by Martyn Gigg

Command interpreter is mostly working. Refs #5006

Changeset: 87cfb0b51bffd5d764da9b2d9fa388c61e085712

comment:5 Changed 9 years ago by Martyn Gigg

Script interpreter executes code asynchronously. Refs #5006

Changeset: b9796618fa57679ea1eafcce25f85f2b6760814f

comment:6 Changed 9 years ago by Martyn Gigg

Tweak the interpreter name. Refs #5006

Changeset: f3f3cbdadf72f7277c6d95f7a6559414a7923004

comment:7 Changed 9 years ago by Martyn Gigg

Show errors from file scripts. Refs #5006

Changeset: a5d5fed7b105b797cca975eea3a99d28b4cad1fc

comment:8 Changed 9 years ago by Martyn Gigg

Connected most of the menu signals in script window. Refs #5006

Changeset: 00d28f055a899f5c7da326a6c72fa23d332af803

comment:9 Changed 9 years ago by Martyn Gigg

First cut at a python GUI fn working from diff thread. Refs #5006

Anything other than plotSpectrum will crash!

Changeset: 1a0ef130c5e6345efeedec2d4ee55cf027a64bef

comment:10 Changed 9 years ago by Martyn Gigg

Reworked Script Window to isolate scripts from each other. Refs #5006

Changeset: 59b4800b46ccd16deec3c04398a3191f86e8e00e

comment:11 Changed 9 years ago by Martyn Gigg

Command interpreter is mostly working. Refs #5006

Changeset: f2a416393131d3a983d13cdaa9c2d58c90ca5435

comment:12 Changed 9 years ago by Martyn Gigg

Script interpreter executes code asynchronously. Refs #5006

Changeset: 88590e40f2548af747b341a960f53c79857fb621

comment:13 Changed 9 years ago by Martyn Gigg

Tweak the interpreter name. Refs #5006

Changeset: 2a103fe2af04a846b89255e43b42a4d82ae48f90

comment:14 Changed 9 years ago by Martyn Gigg

Show errors from file scripts. Refs #5006

Changeset: 516a6b0ef9d8bdb0b52d0e34c8dc72abd0823f26

comment:15 Changed 9 years ago by Martyn Gigg

Connected most of the menu signals in script window. Refs #5006

Changeset: 93707eb908e850fa28d449e2e963e906b6aa1c29

comment:16 Changed 9 years ago by Martyn Gigg

Add GIL locks for old API Python algorithms. Refs #5006

Changeset: d389eb467ecc2e6d92246f169e4c707f4e75128e

comment:17 Changed 9 years ago by Martyn Gigg

Make Python dialog funcs callable from a separate thread. Refs #5006

Changeset: 48818f3047ad7d2e5824d3f9eab7584acb4d88ea

comment:18 Changed 9 years ago by Martyn Gigg

The 1DPlot tests not work from a separate thread. Refs #5006

Changeset: ae926af2876ec322dd8836b84d85a0be30072efc

comment:19 Changed 9 years ago by Martyn Gigg

Add required threading calls to new Python Algorithms. Refs #5006

Changeset: ec067135de78abf2b6309b7a6d682244aa52f0b5

comment:20 Changed 9 years ago by Martyn Gigg

Replace C++ ThreadAdaptor with more flexible Python class. Refs #5006

This makes the wrapping so much simpler that future additions only need to make sure their call is wrapped in threadsafe_call.

Changeset: fa0a2204979cff9b9eaea5378707d2871ac7ee7b

comment:21 Changed 9 years ago by Martyn Gigg

All MantidPlot tests now work. Refs #5006

In addition the output from the tests is no longer captured by MantidPlot to make for easier debugging and better error reports.

Changeset: 28a166e4bb0b2e4370ab633e0b469750aa53d700

comment:22 Changed 9 years ago by Martyn Gigg

Add export declaration in Python layer. Refs #5006

Also replaced sleep with wait on future.

Changeset: bea7535586984056951675d771f83ce1c4a69391

comment:23 Changed 9 years ago by Martyn Gigg

Simplify threading structure. Refs #5006

Changeset: e4d059a097cd5b4e5b8777ebad806b6136ca10f1

comment:24 Changed 9 years ago by Martyn Gigg

Make sure initial Python threadstate is null. Refs #5006

If not windows dead locks on the first call to PyGILState_Ensure as the initial thread initialization still holds a mutex.

Changeset: 5cab8f05eb1853ed1f72dc99458019ef0ac93385

comment:25 Changed 9 years ago by Martyn Gigg

Add find/replace dialog for editor. Refs #5006

Changeset: 4a0f55b2a2b8220c67200a97b3d5cf98a02e1b2d

comment:26 Changed 8 years ago by Martyn Gigg

Process events while waiting for script to finish. Refs #5006

Ensures that the events are proceesed when the unit tests are running (fixes them on windows).

Changeset: 06be2fb6a2f885f2922abd50d5e7314be818171c

comment:27 Changed 8 years ago by Martyn Gigg

Control the shutdown of the interpreter. Refs #5006

The destructors run too late and in an undefined order so we need to ensure that all scripts are deleted before the enviroment is shutdown. This only affected the Linux platforms in release for some reason.

Changeset: ebb1b05785bb8ca5c50bebb27a700dd2be478148

comment:28 Changed 8 years ago by Martyn Gigg

Disable script exec while same script is running. Refs #5006

Also fix segfault on shutdown.

Changeset: 6f74c198db3a6335d3c4d8991131ae85a4f9a7a7

comment:29 Changed 8 years ago by Martyn Gigg

Add a status bar to the script file widget. Refs #5006

Simply displays the execution status at the moment but in the future we could have a cancellation button and other information.

Changeset: 52450ef2bf2b244807725fd4b307ef94c28f5bca

comment:30 Changed 8 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to fixed

I'm marking this as fixed, any bugs can go into their own ticket as this has grown quite large.

comment:31 Changed 8 years ago by Mathieu Doucet

Re #5006 Fix plotspectrum calls

Changeset: 79d979c9e278c8d3dd9894ff535779ec05502bf9

comment:32 Changed 8 years ago by Mathieu Doucet

Re #5006 Fix plotspectrum calls

Changeset: 7e5082f329eca303fe1658189a75398df77b8660

comment:33 Changed 8 years ago by Peter Parker

Refs #5006 - Small fix for Indirect part of C2E.

Changeset: f2b71e6b6d3a36984cf59703c172eb08b8d83b72

comment:34 Changed 8 years ago by Martyn Gigg

Fix MantidPlot -x so that it opens the script window. Refs #5006

Changeset: 263a1d11adbb1d65969d200bf95a1ca768105c97

comment:35 Changed 8 years ago by Martyn Gigg

Rename ScriptManagerWidget->MultiTabInterpreter. Refs #5006

Changeset: f659a69ba481d3bd6d73d4754235965b6dc8b982

comment:36 Changed 8 years ago by Martyn Gigg

Disable script exec while same script is running. Refs #5006

Also fix segfault on shutdown.

Changeset: 6f74c198db3a6335d3c4d8991131ae85a4f9a7a7

comment:37 Changed 8 years ago by Martyn Gigg

Add a status bar to the script file widget. Refs #5006

Simply displays the execution status at the moment but in the future we could have a cancellation button and other information.

Changeset: 52450ef2bf2b244807725fd4b307ef94c28f5bca

comment:38 Changed 8 years ago by Mathieu Doucet

Re #5006 Fix plotspectrum calls

Changeset: 79d979c9e278c8d3dd9894ff535779ec05502bf9

comment:39 Changed 8 years ago by Mathieu Doucet

Re #5006 Fix plotspectrum calls

Changeset: 7e5082f329eca303fe1658189a75398df77b8660

comment:40 Changed 8 years ago by Peter Parker

Refs #5006 - Small fix for Indirect part of C2E.

Changeset: f2b71e6b6d3a36984cf59703c172eb08b8d83b72

comment:41 Changed 8 years ago by Martyn Gigg

Fix MantidPlot -x so that it opens the script window. Refs #5006

Changeset: 263a1d11adbb1d65969d200bf95a1ca768105c97

comment:42 Changed 8 years ago by Martyn Gigg

Rename ScriptManagerWidget->MultiTabInterpreter. Refs #5006

Changeset: f659a69ba481d3bd6d73d4754235965b6dc8b982

comment:43 Changed 8 years ago by Martyn Gigg

Fix 2D plot python proxies. Refs #5006

Changeset: 20b191c2d479df28092872e6c0cef374c7adb8c7

comment:44 Changed 8 years ago by Martyn Gigg

Remove double disconnect of proxy. Refs #5006

Changeset: 00f9dbb9fb91b179accd1f407f1c9b9b5cfb5a47

comment:45 Changed 8 years ago by Martyn Gigg

Fix 2D plot python proxies. Refs #5006

Changeset: 20b191c2d479df28092872e6c0cef374c7adb8c7

comment:46 Changed 8 years ago by Martyn Gigg

Remove double disconnect of proxy. Refs #5006

Changeset: 00f9dbb9fb91b179accd1f407f1c9b9b5cfb5a47

comment:47 Changed 8 years ago by Stuart Campbell

  • Status changed from verify to verifying
  • Tester set to Stuart Campbell

comment:48 Changed 8 years ago by Stuart Campbell

  • Status changed from verifying to closed

Can run multiple live monitors, and can still run command in the terminal.

comment:49 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 5852

Note: See TracTickets for help on using tickets.