[kepler-dev] Stop a workflow from Command Line

Christopher Brooks cxh at eecs.berkeley.edu
Mon Apr 5 08:36:35 PDT 2010


Hi Subhav,
You would need to write an actor that listened for signals and
then behaved like the Stop actor when it received a certain signal,
such as SIGHUP, which is usually signal 1.  Catching signals
in Java is not easy, but it is doable.

_Christopher

On 4/4/10 5:39 PM, subhav mital wrote:
> Thanks so much for this great explanation.
>
> I have tried to stop the workflow in Windows using the TaskKill command,
> but that exits the application alongwith stopping the workflow.Is kill
> -1 %1 similar to that?
>
> What I wish to simulate is similar to clicking the stop button from
> within the workflow while it runs.
>
> Eg:
>
> You are at Stage 2 of the workflow. Now due to some reason, you wish to
> exit. Is there any way to accomplish this? (Kepler Application should be
> running but the workflow must stop such that if desired you can restart
> the workflow by hitting the play button)
>
> Thanks.
>
>
>
>
> On Mon, Mar 29, 2010 at 4:40 PM, Christopher Brooks
> <cxh at eecs.berkeley.edu <mailto:cxh at eecs.berkeley.edu>> wrote:
>
>     Hi Subhav,
>     Are you talking about the PN model of computation?
>     If so, then take a look at:
>     http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/ptII/doc/codeDoc/ptolemy/domains/pn/kernel/PNDirector.html
>     --start--
>     There are at least three ways for a PN model to terminate itself:
>
>        1. Have the model starve itself. Typically, a boolean switch is used.
>           See the PN OrderedMerge demo at
>     ptolemy/domains/pn/demo/OrderedMerge/OrderedMerge.xml
>        2. Have the model call the Stop actor. See the PN RemoveNilTokens
>     demo at
>           ptolemy/domains/pn/demo/RemoveNilTokens/RemoveNilTokens.xmll
>        3. Set the firingCountLimit
>     (LimitedFiringSource._firingCountLimit) actor parameter
>           to the number of iterations desired. Actors such as Ramp
>     extend LimitedFiringSource
>           and have the firingCountLimit parameter.
>     --end--
>
>     Unfortunately, the Kepler-2.0 documentation for the PN director has
>     not been updated to
>     reflect recent changes in the class documentation for
>     PNDirector.java.  I think this
>     is because directors-2.0/resources/kar/CoreDirectors/PNDirector.xml
>     has not been updated.
>     Thus, right clicking on the PNDirector and choosing
>     Documentation->Display does not
>     include the above.  I'll submit a bug.
>
>     There is no particular command line interface to stop a model.  In
>     theory, an actor could
>     be written that would watch for signals and if the appropriate
>     signal was sent, then
>     it would fire.  This actor could then be connected to a Stop actor.
>       However, I'm not
>     so sure signal handling in Java is well documented or portable.
>
>     The way this would work in Unix is to run the model in the
>     background and then
>     use "kill -1 %1" where -1 means that SIGHUP is passed to the Kepler
>     process.
>
>
>     Note that vergil includes a -runThenExit command line argument, see
>     ptolemy/actor/gui/ConfigurationApplication.java
>     For this to work, the application has to terminate though.
>
>     I'm not sure if Kepler exposes that command line argument.  See
>     https://kepler-project.org/developers/reference/executing-kepler-from-the-command-line
>
>     _Christopher
>
>     On 3/28/10 11:59 PM, subhav mital wrote:
>
>         Hello,
>
>         Just wondering if there is any way to stop a workflow after
>         execution is
>         complete. While running some actors, even after the workflow has
>         completed, the play button seems on and one has to manually hit
>         the stop
>         button.
>
>         Is there any command line statement to start and stop a workflow
>         without
>         having to manually do this ?
>
>         Thanks.
>
>
>
>         _______________________________________________
>         Kepler-dev mailing list
>         Kepler-dev at kepler-project.org <mailto:Kepler-dev at kepler-project.org>
>         http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>
>
>     --
>     Christopher Brooks, PMP                       University of California
>     CHESS Executive Director                      US Mail: 337 Cory Hall
>     Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
>     ph: 510.643.9841 fax:510.642.2718             (Office: 545Q Cory)
>     home: (F-Tu) 707.665.0131 cell: 707.332.0670
>
>

-- 
Christopher Brooks, PMP                       University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841 fax:510.642.2718	      (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670


More information about the Kepler-dev mailing list