Hi,
some time ago we discussed on the list a new WPS extension point that would allow
developers to listen to the process lifecycle:
http://osgeo-org.1560.n6.nabble.com/A-new-extension-point-for-the-WPS-module-process-lifecycle-listener-td4979017.html#a4981375
Based on that discussion I’ve put togheter a set of classes that implements those ideas.
The process listener:
https://github.com/aaime/geoserver/blob/wps-listener/src/extension/wps/wps-core/src/main/java/org/geoserver/wps/executor/ProcessListener.java
And its parameter, the process event:
https://github.com/aaime/geoserver/blob/wps-listener/src/extension/wps/wps-core/src/main/java/org/geoserver/wps/executor/ProcessEvent.java
The code is already wired up to work against all kind of invocations in the WPSProcessExecutor, using this class as a hub
centralizing event management:
https://github.com/aaime/geoserver/blob/wps-listener/src/extension/wps/wps-core/src/main/java/org/geoserver/wps/executor/ProcessListeners.java
Compared to the original design there is a new event, process completed, that takes into account the
full lifecycle, that is, not just execution, but also output encoding, which migth take quite a bit of time
and, in the case of fully streaming processes, is actually the phase in which the computation is
effectively run (execution often just returns a feature collection wrapper or a JAI operation that
is then run only during output encoding).
My intention would be to add tests and then add in the WPS configuration a way to control
the maximum execution time, with automatic process cancellation in case the process takes too much time.
Unfortunately that will work only with a subset of the processes that can actually be stopped, and
for streaming processes there is the hiccup that the actual processing happens while we encode…
I guess we could provide the listener the output stream somehow, for example:
- for asynch processes, the output stream is known to the WPS since we are writing the response
to a temporary file, so we have it - for synch processes things are managed by the dispatcher, but by implementing DispatcherCallback
we could wrap the Response class, and give the real Response class a wrapped output stream
in the Response.write(value, stream, operation) method
Opinions and suggestions welcomed (really, I mean it :-p )
Cheers
Andrea
–
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it