13

I've written a QGIS processing script that carries out a closest facility analysis. Taking the complete input data set (20k adresses as start points, ~100 target points, OSM road network with ~13k linestrings) the script runs about 3 hours, and therefore makes use of various progress indicators, to make shure to the user that it's still alive (log output, progress bar, time remaining, rubber bands indication the way to closest facililty just processed, cp. screenshot below):

enter image description here

Now I would like to cancel the running script and as far as I can see, this can only be done with [X] top right in the processing script gui window.

But doing so, the script remains processing as indicated by the blue rubber bands as well as the processing time and the progress bar...

enter image description here

enter image description here

... and the system resources in the task manager:

enter image description here

enter image description here

However, couple of minutes (~14min) later on the script stops processing and the system is not consuming anymore resources:

enter image description here

enter image description here

enter image description here

Since the time span between closing the window and stopping processing seems fairly unpredictable to me, my question is: Is this a recommended way to cancel QGIS processing scripts, or are there other ways to cleanly cancelling such scripts from the gui?

2
  • Surely not the best nor the clearest way to do it, but I generally literally kill the process from the Windows Task Manager: this action has the closure of QGIS as a consequence, but also the interruption of the script and the saving of the system resources. However, if you want to have an idea of the remaining time, you may set the progress bar according to the iteration over the features (I don't know if this is what you want).
    – mgri
    Commented May 29, 2017 at 12:49
  • Perhaps this post might help: How to terminate Python scripts in Processing framework properly?. In particular, gene's answer using sys.exitfunc().
    – Joseph
    Commented May 30, 2017 at 11:04

1 Answer 1

3

From command shell, "taskkill /f /im qgis-ltr-bin.exe /t" would terminate the process immediately. I don't think there's a gui solution, based on what you're going for though. In QGIS, if you wanted to end the process cleanly, you'd have to wait for the program when ending the process. But via command shell this would allow you to move forward right away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.