[Geoserver-devel] A new extension point for the WPS module: process lifecycle listener

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

On Mon, Jun 4, 2012 at 5:46 PM, Andrea Aime
<andrea.aime@anonymised.com> wrote:

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).

I'll assume no feedback means no objection and move on :slight_smile:

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

No… it just means folks are busy :slight_smile: I am interested in this but will probably not get to it until the weekend to really read through and understand it.

On Tue, Jun 5, 2012 at 9:22 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Mon, Jun 4, 2012 at 5:46 PM, Andrea Aime
<andrea.aime@anonymised.com> wrote:

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).

I’ll assume no feedback means no objection and move on :slight_smile:

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


Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Sorry, meant that to mean proceed as you see fit, but if you actually want/need feedback i probably can’t get to it for a few days.

On Tue, Jun 5, 2012 at 2:35 PM, Justin Deoliveira <jdeolive@anonymised.com> wrote:

No… it just means folks are busy :slight_smile: I am interested in this but will probably not get to it until the weekend to really read through and understand it.

On Tue, Jun 5, 2012 at 9:22 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Mon, Jun 4, 2012 at 5:46 PM, Andrea Aime
<andrea.aime@anonymised.com> wrote:

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).

I’ll assume no feedback means no objection and move on :slight_smile:

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


Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Ok, found some spare cycles to read through this. And while I don’t have a lot of experience to draw from with WPS but I thin i like the second interface as well, that is not separating special methods for changed execution and try to handle them with a single interface.

What type of object gets passed in as the executionId? One possibily would be to roll a new “Execution” sort of descriptor class that could maintain the actual id of the process, and other execution info such whether the process is actually a changed one or not. Would also leave the door open to more info specially about how the process is executed without having to modify the methods further.

$0.02

-Justin

On Tue, Jun 5, 2012 at 2:54 PM, Justin Deoliveira <jdeolive@anonymised.com> wrote:

Sorry, meant that to mean proceed as you see fit, but if you actually want/need feedback i probably can’t get to it for a few days.

On Tue, Jun 5, 2012 at 2:35 PM, Justin Deoliveira <jdeolive@anonymised.com> wrote:

No… it just means folks are busy :slight_smile: I am interested in this but will probably not get to it until the weekend to really read through and understand it.

On Tue, Jun 5, 2012 at 9:22 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Mon, Jun 4, 2012 at 5:46 PM, Andrea Aime
<andrea.aime@anonymised.com> wrote:

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).

I’ll assume no feedback means no objection and move on :slight_smile:

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


Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

On Wed, Jun 6, 2012 at 7:51 AM, Justin Deoliveira <jdeolive@anonymised.com> wrote:

Ok, found some spare cycles to read through this. And while I don't have a
lot of experience to draw from with WPS but I thin i like the second
interface as well, that is not separating special methods for changed
execution and try to handle them with a single interface.

What type of object gets passed in as the executionId?

It's a string, it is the identifier for all WPS requests and the one that gets
returned when doing an asynch one. Internally it's built as a UUID.

One possibily would
be to roll a new "Execution" sort of descriptor class that could maintain
the actual id of the process, and other execution info such whether the
process is actually a changed one or not. Would also leave the door open to
more info specially about how the process is executed without having to
modify the methods further.

I like the approach. I guess ExecutionEvent is probably a better name for
a parameter of a listener?
And it woudl be the only parameter of all methods, just that at a different
point in the execution workflow it would have different kind of values attached.
We could actually have a single callback method and specify the phase
as a ExecutionEvent attribute... but then the listeners would have to do a
if/switch inside the method...

Opinions?

Cheers
Andrea

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

On Thu, Jun 14, 2012 at 4:51 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Wed, Jun 6, 2012 at 7:51 AM, Justin Deoliveira <jdeolive@anonymised.com> wrote:

Ok, found some spare cycles to read through this. And while I don’t have a
lot of experience to draw from with WPS but I thin i like the second
interface as well, that is not separating special methods for changed
execution and try to handle them with a single interface.

What type of object gets passed in as the executionId?

It’s a string, it is the identifier for all WPS requests and the one that gets
returned when doing an asynch one. Internally it’s built as a UUID.

One possibily would
be to roll a new “Execution” sort of descriptor class that could maintain
the actual id of the process, and other execution info such whether the
process is actually a changed one or not. Would also leave the door open to
more info specially about how the process is executed without having to
modify the methods further.

I like the approach. I guess ExecutionEvent is probably a better name for
a parameter of a listener?
And it woudl be the only parameter of all methods, just that at a different
point in the execution workflow it would have different kind of values attached.
We could actually have a single callback method and specify the phase
as a ExecutionEvent attribute… but then the listeners would have to do a
if/switch inside the method…

Sounds good, ExecutionEvent makes sense. I do think it would be nicer to have separate methods for different points of execution if possible, seems to jive a little more with the rest of our “callback interfaces”. But no strong opinion.

Opinions?

Cheers
Andrea

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


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.