ISISNeutronMuon / MDANSE

MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments
https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx
GNU General Public License v3.0
21 stars 5 forks source link

Add qprocess job launching #328

Closed MBartkowiakSTFC closed 8 months ago

MBartkowiakSTFC commented 8 months ago

Description of work We switch from QThread to multiprocessing.Process for starting new jobs. This way the jobs will not be competing for the Python GIL.

Fixes A State pattern has been implemented for jobs. A context menu lets the user pause, restart and terminate jobs from the GUI. Each job is a process and uses pipes to communicate with the main process.

To test Run a few longer jobs at the same time. See if they all use 100% of a CPU core. Try pausing and resuming them.

ChiCheng45 commented 8 months ago

A few issues I've found from my testing so far.

Animation9

image

MBartkowiakSTFC commented 8 months ago

Thanks for finding these problems! Regarding the jobs that keep running after the GUI has been closed: do they finish normally, and produce correct results?

ChiCheng45 commented 8 months ago

Thanks for finding these problems! Regarding the jobs that keep running after the GUI has been closed: do they finish normally, and produce correct results?

I just tried it with a trajectory conversion and I closed the main window before it finished. After waiting some time it produced an MDT file which loads successfully with a new MDANSE.

So yea it appears to finish successfully.

MBartkowiakSTFC commented 8 months ago

That's good, really. Thanks for checking!

I will fix the other problems in this PR, and for the processes outliving the GUI we will have to make a separate issue.

ChiCheng45 commented 8 months ago

Everything seems to work from my testing.

The only thing is that when I run a trajectory conversion, the MDT file are created before its completes. When I terminate the job the files remain. I've created #342 for this issue.