Hi,

I would like to use a processing algorithm in a plugin,
and run it as a QgsTask to avoid user interface "freeze".

I have tested with QGIS 3 (3.0.2) using the "native.buffer"
algorithm and a line vector layer:

 context = QgsProcessingContext()
 alg=QgsApplication.processingRegistry().algorithmById('native:buffer')
 params={
   'INPUT': inputlayer,
   'DISTANCE': 100.0,
   'OUTPUT':'/home/test.shp'
 }
 task = QgsProcessingAlgRunnerTask(alg,params,context)
 QgsApplication.taskManager().addTask(task)

The algorithm runs fine (the progressbar in the status
area at the bottom of the QGIS interface is counting up
to 100% and the buffer data set is generated and OK),
but QGIS crashes immediately after the algorithm has
completed:

QGIS died on signal 11Could not attach to process. If your uid matches the uid of the target
 process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
 ptrace: Operation not permitted.
 No thread selected
 No stack.
 gdb returned 0
 Aborted (core dumped)

It would be great if someone could explain the proper way
of using QgsProcessingAlgRunnerTask, and perhaps provide
an example of how to use it in a plugin.  I have tried to
search the web, but have not found much.
How should the "context" be set?
How should the task and the results be handled?
...


Håvard
--
Håvard Tveite
Faculty of Sciences and Technology, NMBU
Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
Phone: +47 67231548   Web: http://www.nmbu.no
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to