<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Christine,<br>
The description below is more for Ptolemy, the execution engine that
is used<br>
by Kepler.<br>
<br>
Classes like ptolemy.moml.MoMLSimpleApplication have a
executionError() method<br>
that is called when there is an error at runtime. I'm not sure what
class Kepler is calling<br>
in batch mode, but if it is not MoMLSimpleApplication, then it is
fairly similar.<br>
<br>
You could modify that method to "do the right thing," though this
seems awfully model<br>
specific.<br>
<br>
Another way is that there are two actors, ThrowModelError and
ThrowException<br>
<a class="moz-txt-link-freetext" href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/actor/lib/ThrowModelError.html">http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/actor/lib/ThrowModelError.html</a><br>
<a class="moz-txt-link-freetext" href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/actor/lib/ThrowException.html">http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/actor/lib/ThrowException.html</a><br>
<br>
The docs for ThrowModelError say:<br>
<br>
<blockquote type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<p>An actor that throws a model error when it receives a true
token on any input channel. The message reported in the model
error is given by the <i>message</i> parameter. The inputs are
read and checked in the postfire() method only. </p>
<p> A model error is an exception that is passed up the
containment hierarchy rather than being immediately thrown. Any
container in the containment hierarchy may choose to handle the
error. By default, containers will pass and delegate the error
to their container, if they have one, and throw an exception if
they don't. But some containers might do more with the error.</p>
</blockquote>
<br>
NamedObj.handleModelError() is the code that is called.<br>
<br>
<a class="moz-txt-link-freetext" href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/kernel/util/NamedObj.html#handleModelError%28ptolemy.kernel.util.NamedObj,%20ptolemy.kernel.util.IllegalActionException%29">http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/kernel/util/NamedObj.html#handleModelError%28ptolemy.kernel.util.NamedObj,%20ptolemy.kernel.util.IllegalActionException%29</a><br>
says:<br>
<br>
<blockquote type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
Handle a model error. If a model error handler has been registered
with setModelErrorHandler(), then handling is delegated to that
handler. Otherwise, or if the registered error handler declines to
handle the error by returning false, then if there is a container,
handling is delegated to the container. If there is no container
and no handler that agrees to handle the error, then return false.
<p> A typical use of this facility is where a subclass of NamedObj
does the following: </p>
<pre> handleModelError(this, new IllegalActionException(this, message));
</pre>
instead of this:
<pre> throw new IllegalActionException(this, message);
</pre>
The former allows a container in the hierarchy to intercept the
exception, whereas the latter simply throws the exception.
</blockquote>
<br>
handleModelError() is typically called in Modal Models where an
error transition should be taken.<br>
<br>
ptolemy.kernel.util.BasicModelErrorHandler has a handleModelError()
method that merely<br>
throws the exception. Classes like ptolemy.actor.gui.PtolemyFrame
set the model handler to<br>
BasicModelErrorHandler<br>
<br>
_model.setModelErrorHandler(new BasicModelErrorHandler());<br>
<br>
So, for actors that throw model errors, you could register a model
error handler that did <br>
what you want.<br>
<br>
To monitor execution status, see ptolemy.actor.ExecutionListener.
You could<br>
use managerStateChanged. You can also attach a listener to a
director or actor and<br>
get information that way. The way the UI implements the "Listen to
Director" menu choice<br>
is in ptolemy.vergil.actor.ActorGraphFrame. Search for "Listen to
Director".<br>
See ptolemy.vergil.actor.ActorController for how "Listen to Actor"
is implemented.<br>
<br>
_Christopher<br>
<br>
<br>
On 8/24/11 7:13 AM, Smit, Christine E. (GSFC-610.2)[TELOPHASE CORP]
wrote:
<blockquote
cite="mid:4FE66DCA08213A49981B324122CCF6C08A7DBFF5B6@NDMSSCC06.ndc.nasa.gov"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">A lot of the built-in actors throw
exceptions in certain situations. Is there some way to
gracefully catch these exceptions, particularly when we are
running kepler workflows from the command line (i.e. without
the GUI)? For example, the XPath Processor throws an exception
if it doesn't find the path specified, but this might not
always really be an error in an actual workflow. Is there any
way we could automatically recover from this error and
continue execution?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">More generally, is there any way to
externally monitor Kepler's execution status?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks.<o:p></o:p></p>
<p class="MsoNormal">Christine<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">--------------------------------<o:p></o:p></p>
<p class="MsoNormal">Dr. Christine Smit<o:p></o:p></p>
<p class="MsoNormal"><a moz-do-not-send="true"
href="mailto:christine.e.smit@nasa.gov">christine.e.smit@nasa.gov</a><o:p></o:p></p>
<p class="MsoNormal">+1-301-614-5752<o:p></o:p></p>
<p class="MsoNormal">NASA Goddard, Building 32, N126-12<o:p></o:p></p>
<p class="MsoNormal">Code 610.2<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kepler-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kepler-users@kepler-project.org">Kepler-users@kepler-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
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 (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670 </pre>
</body>
</html>