Ticket #5766 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

Use dedicated thread per script

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: major Milestone: Release 2.3
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Anders Markvardsen

Description (last modified by Martyn Gigg) (diff)

The python script threading currently uses the QtConcurrent::run to execute the scripts asynchronously. This uses the global thread pool which has a expiry timeout for each thread of 30 seconds.

For most things this isn't an issue but the instrument control work uses DCOM and when the thread dies the connection is not dropped correctly so it can't reset properly.

Most people are not going to have a huge number of scripts open at once so if we use a single thread per script then this shouldn't be a problem.

Change History

comment:1 Changed 8 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:2 Changed 8 years ago by Martyn Gigg

  • Description modified (diff)
  • Summary changed from Turn off the thread time out for Python script threads in MantidPlot to Use dedicated thread per script

comment:3 Changed 8 years ago by Martyn Gigg

Use a dedicated thread for each script instance. Refs #5766

Changeset: 1860b022d844a3a3001c9be3b18575b7e313d1e3

comment:4 Changed 8 years ago by Martyn Gigg

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

comment:5 Changed 8 years ago by Martyn Gigg

MantidPlot tests in serial while diagnosing test failure. Refs #5766

Changeset: 4dc301b6d74bef34a841fdc513744f1066770f5f

comment:6 Changed 8 years ago by Martyn Gigg

  • Status changed from verify to reopened
  • Resolution fixed deleted

comment:7 Changed 8 years ago by Martyn Gigg

Return to thread pool until proper impl is sorted out. Refs #5766

Changeset: 76c3110c61dbdf3bc246f3447f47d7c44e2e64a4

comment:8 Changed 8 years ago by Martyn Gigg

Fix probelms with single thread per script. Refs #5766

Simplified code by using a threadpool with max threads=1 per script object. This leaves all the complex locking management to the Qt framework code.

Changeset: 0c8f54b74b322f19e8efcf520ec7b62506df2e6a

comment:9 Changed 8 years ago by Martyn Gigg

  • Status changed from reopened to accepted

comment:10 Changed 8 years ago by Martyn Gigg

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

comment:11 Changed 8 years ago by Martyn Gigg

Use a dedicated thread for each script instance. Refs #5766

Changeset: 1860b022d844a3a3001c9be3b18575b7e313d1e3

comment:12 Changed 8 years ago by Martyn Gigg

MantidPlot tests in serial while diagnosing test failure. Refs #5766

Changeset: 4dc301b6d74bef34a841fdc513744f1066770f5f

comment:13 Changed 8 years ago by Martyn Gigg

Return to thread pool until proper impl is sorted out. Refs #5766

Changeset: 76c3110c61dbdf3bc246f3447f47d7c44e2e64a4

comment:14 Changed 8 years ago by Martyn Gigg

Fix probelms with single thread per script. Refs #5766

Simplified code by using a threadpool with max threads=1 per script object. This leaves all the complex locking management to the Qt framework code.

Changeset: 0c8f54b74b322f19e8efcf520ec7b62506df2e6a

comment:15 Changed 8 years ago by Anders Markvardsen

  • Status changed from verify to verifying
  • Tester set to Anders Markvardsen

comment:16 Changed 8 years ago by Anders Markvardsen

  • Status changed from verifying to closed

Tested this by running a matplotlib script in asynchrous and serialised mode.

When running the script in serialised mode it works.

When running in asynchronous mode it hangs, as expected, and varifies well enough the work in this ticket.

However, consider adding a help menu to MantidPlot: Python Window, which may have a few links to wiki pages already created plus a small section that explain when it is preferable to use serialised mode

comment:17 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6612

Note: See TracTickets for help on using tickets.