Attach message or reason when timeout happens

32 views
Skip to first unread message

ddeng

unread,
Jun 19, 2012, 3:29:11 PM6/19/12
to openwfe...@googlegroups.com
Hi:
I have following code:

    pdef = Ruote.process_definition do
      sequence :on_error=>:error_report do
        alpha :id => "alpha", :timers => "1s: reminder, 2s:error"
        bravo :id => "bravo"
      end
    end

    @dashboard.register_participant "alpha", TimeoutParticipant
    @dashboard.register_participant "bravo", TimeoutParticipant
    @dashboard.register_participant :reminder do |item|
      puts "reminder handling"
    end
    @dashboard.register_participant :error_report do |item|
      puts "reporting error"
      puts item.error.inspect
    end

my intentions are:
1. in 1 sec send a reminder to alpha
2. in 2 sec, cancel the process and the "error_report" handler comes in to do the housekeeping work.

The problem is:
When I say "item.error.inspect" in the error_report handler, it gives me: "class"=>"Ruote::ForcedError", "message"=>"error triggered from process definition". Which is not helpful when I want to know that the error is triggered by a timeout from alpha

btw: I tried 
alpha :id => "alpha", :timers => "1s: reminder, 2s:timeout"
but the process is not interrupted when timeout happened.

Any help is appreciated
Thanks in advance

John Mettraux

unread,
Jun 19, 2012, 3:33:34 PM6/19/12
to openwfe...@googlegroups.com

On Tue, Jun 19, 2012 at 12:29:11PM -0700, ddeng wrote:
>
> I have following code:
>
> pdef = Ruote.process_definition do
> sequence :on_error=>:error_report do
> alpha :id => "alpha", :timers => "1s: reminder, 2s:error"
> bravo :id => "bravo"
> end
> end
>
> (...)
>
> my intentions are:
> 1. in 1 sec send a reminder to alpha
> 2. in 2 sec, cancel the process and the "error_report" handler comes in to
> do the housekeeping work.
>
> The problem is:
> When I say "item.error.inspect" in the error_report handler, it gives
> me: "class"=>"Ruote::ForcedError", "message"=>"error triggered from process
> definition". Which is not helpful when I want to know that the error is
> triggered by a timeout from alpha

OK, please fill an issue about that and I'll come up with something:

https://github.com/jmettraux/ruote/issues

> btw: I tried
> alpha :id => "alpha", :timers => "1s: reminder, 2s:timeout"
> but the process is not interrupted when timeout happened.

Yes, that's the expected behaviour.

(Although the workitem goes on with a __timed_out__ field set).


Thanks in advance,

--
John Mettraux - http://lambda.io/jmettraux

ddeng

unread,
Jun 19, 2012, 3:50:29 PM6/19/12
to openwfe...@googlegroups.com
issue filed:  https://github.com/jmettraux/ruote/issues/50 

Thanks for your effort :)

John Mettraux

unread,
Jun 21, 2012, 4:04:08 AM6/21/12
to openwfe...@googlegroups.com

On Tue, Jun 19, 2012 at 12:50:29PM -0700, ddeng wrote:
>
> issue filed: https://github.com/jmettraux/ruote/issues/50

Hello,

I've made the error more explicit:

https://github.com/jmettraux/ruote/commit/b5381aa4ae03c1df407b8d3997165e47e0261274

Please note that you can set a custom error message, like in:

https://github.com/jmettraux/ruote/blob/1ed73aa25195ab8b036a0c9119a26e156bfaaa79/test/functional/ft_65_timers.rb#L188-207

Feel free to re-open the issue if you feel the solution is not OK.


Thanks for the feedback!
Reply all
Reply to author
Forward
0 new messages