[kepler-users] Running a DOE inside of Kepler
Hogan, D. (GE Energy)
D.Hogan at ge.com
Wed Mar 14 15:13:29 PDT 2012
> Edward A. Lee wrote:
> You can create an object in a model that implements the
ExceptionHandler interface. An example is the TestExceptionHandler
actor, which is used in regression tests. Offhand, I'm not sure whether
there are other examples.
Thanks for the tip. I'm running into a couple of problems with the
exception handling:
1) If I use a TestExceptionHandler, it only catches exceptions when it
is placed in the top level. If it is inside of a composite actor, it
doesn't catch the exception. I looked through some of the Ptolemy tests
and they use TestExceptionHandler at the top level.
a. If I extend CompositeActor to implement ExceptionHandler, then I
am able to catch an exception inside of that composite actor. It is
still the same problem though. When the composite actor that has an
ExceptionHandler is not in the top level, it doesn't catch the
exception.
2) I need to continue to the next iteration after an exception but it
terminates.
I think the first problem is probably working as designed. From the
documentation, it made a distinction between model errors that can be
caught in the workflow hierarchy and exceptions. In my case, I need to
be able to handle both locally in the workflow. For instance, I can
have a nested workflow where there are multiple tools that do a similar
job but with different characteristics such as runtime, fidelity,
validation and robustness in the design space. I need to be able to
catch any error/exception one tool or its workflow throws and try the
next best tool. All of this could happen in some composite actor inside
of a large workflow so a global exception handler isn't workable. Would
it be advisable to modify the code to traverse the workflow hierarchy to
find actors that implement ExceptionHandler? Is there a reason why it
isn't done currently?
I am trying this in a simple example with a ramp from 0 to 10 that
connects to a composite actor which implements ExceptionHandler. That
actor's workflow throws an exception when the input port value is 3.
Any thoughts on what I should do in handleException() to continue with
the other iterations?
I added a debug listener to my composite actor, its director and
executive director. This is what it displays when the exception is
thrown:
MyCompositeActor: Called iterate(1)
MyCompositeActor: CompositeActor: Calling prefire()
MyCompositeActor: CompositeActor: prefire returns: true
MyCompositeActor: Calling fire()
Director: Called wrapup()
ExecutiveDirector: Called wrapup()
MyCompositeActor: Called wrapup()
MyCompositeActor: Called stopFire()
and then it goes into my handleException() method.
More information about the Kepler-users
mailing list