Hi all,
quick mail to discuss a new extension point for the WPS module, a
process lifecycle listener.
In the current WPS, between the asynch support, chaining and some
extra requirements the full
lifecycle is not exactly simple:
- a process is submitted and scheduled for execution either in the
immediate or asych
queues
- inputs are parsed from their serialized/xml/remote form into java objects
- each process can be served by a separate execution manager (this has
been setup to ease
integration with Grid systems and external executors in general,
systems that act as a wps,
can track progress and the like without using the GeoTools infrastructure)
- chained processes, which are actually processes declared in the
input seciton of
another process, get a different treatment to avoid them creating
deadlock conditions
in the main thread pools
e.g., imagine a thread pool serving immediate requests that
has 3 threads, and a chain of processes that has 4 chained
processes, if we submit
it to the same thread pool we get a deadlock (the last process would
not find any executor
to run into), so the code has a different code path for chained
processes that makes
them run directly in the same thread as the "parent" process
Long story short, the process lifecycle listener could look like this:
ProcessLifecycleListener
- processSubmitted(ExecuteType request, String executionId, boolean
asynchronous, Map<String, Object> inputs, ProcessManager manager)
- processCancelled(executionId)
- processComplete(executionId, Map<String, Object> outputs)
- processFailed(executionId, Exception ex)
- chainedProcessSubmitted(ExecuteType request, Map<String, Object> input)
- chainedProcessComplete(ExecuteType request, Map<String, Object> output)
- chainedProcessFailed(ExecuteType request, Exception ex)
For the normal processes the executionId is what links all the requests, but
for chained processes instead it's the ExecuteType, the chained
portion of request
that defines that process, since we have got no execution id... which is ugly.
Alternatively I guess we could go for this:
ProcessLifecycleListener
- processSubmitted(ExecuteType request, String executionId, boolean
aysnchronous, boolean chained, Map<String, Object> inputs,
ProcessManager manager)
- processCancelled(executionId)
- processComplete(executionId, Map<String, Object> outputs)
- processFailed(executionId, Exception ex)
That is, we make it so that the chained processes get a fake execution
id, have a flag to inform the
listener that the call is actually a chained one, and be done with it.
Or one could do the opposite and hide the execution id, and use always
the ExecuteType... but that would not
be as good imho, executionid is something we expose to the clients so
the listener should be aware of it,
and it would also make it hard/confusing to tell apart two concurrent
requests that actually have the same inputs
(unlikely but not impossible).
Another thing that one might want for the listener is a progress
report, yet that is not there because we
do not assume the Geotools process model is the only one possible, and
progress is following the same
reporting model as WPS, so polling instead of event.
All right. So, open to feedback if you have any, otherwise I'll be
moving on with the second
proposed interface above starting some time tomorrow (as usual I'll
let the planet spin once
to give everybody an occasion to provide feedback if they wish to).
Cheers
Andrea
--
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
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://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
--
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
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://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf