[kepler-dev] Using PN Directors in Kepler
Dan Higgins
higgins at nceas.ucsb.edu
Fri Jun 17 11:08:50 PDT 2005
Perhaps most Kepler users understand this, but I just now managed to
understand some of the details of using PN directors and thought I would
try to document some issues.
My inital problem came when I tried to replace the SDF director in the
simple GARP demo workflow (kepler\workflows\eco\garpModel_ImageJ.xml).
This workflow has 2 Constant actors, the 3 GARP actors (JNI), and an
ImageJ output display actor. When I replaces the SDF director by a PN
director, Kepler either crashed or continued to execute forever.
One method for getting this workflow to run under PN is shown in the
slightly modified version
(kepler\workflows\eco\garpModel_ImageJ_PN.xml). The required changes are
the replacement of the SDF director with a PN director and the addition
of a Ramp actor before the 2 Constant actors with the Ramp actor set to
fire only once.
Why does this work? The real problem is the Constant actors used to
supply string inputs (file names) to the GARP actors. The ordinary
Constant actor will continually supply tokens to whatever actor it is
connected to.
As I understand it, all actors in a workflow are in separate theads.
Actors receive fire events (in some order I don't understand) but they
'block' on the 'get()' method for getting the input port tokens. This
means that the code in the 'fire' method of actors will not execute
until 'get' actually has an input token on all ports where it is looking
for tokens. And, of course, it will not put output tokens on output
ports until the end of the fire method. PN execution ends when all ports
are 'blocked'; i.e. there are no inputs.
This explains the problem with the GARP workflow. When the SDF director
is just replaced with the PN director, the Constant actors supply tokens
to the GARP PresampleLayers actor and it begins to run. But the PN
director will continue to supply tokens, so that GARP actor keeps
getting fired even before the first instance has completed. Adding the
Ramp actor makes sure the Contant actors are only fired once, so the PN
director doesn't keep trying to fire the GARP actor (and after all the
actors are finished the execution terminates).
[Note that Efrat recognized this problem some time ago and created the
ConstOnce actor. This actor just extends the Constant actor and returns
false from the PostFire event to stop returning tokens.]
--
*******************************************************************
Dan Higgins higgins at nceas.ucsb.edu
http://www.nceas.ucsb.edu/ Ph: 805-893-5127
National Center for Ecological Analysis and Synthesis (NCEAS)
Marine Science Building - Room 3405
Santa Barbara, CA 93195
*******************************************************************
More information about the Kepler-dev
mailing list