On Sat, Jun 22, 2013 at 05:17:17PM -0400, Jean-François Rioux wrote:
>
> Hi ruote mailing list,
Hello Jean-François,
welcome to the ruote mailing list.
> I have use cases that express the need for timers that would escalate as
> the deadline approaches. Something in the lines of:
>
> Item is due in 24 hours.
> For the first 12 hours, notify every 4 hours
> For the next 6 hours, notify every 2 hours
> For the next 4 hours, notify every hour
> For the last 2 hours, notify every ½ hour
With a ruote timer, that'd look like:
```ruby
admin :timers =>
'4h: notice, 8h: notice, 12h: notice, 14h: important, 16h: important, ' +
'18h: important, 19h: urgent, 20h: urgent, 21h: urgent, 22h: urgent, ' +
'22h30m: escalation, 23h: escalation, 23h30m: escalation, ' +
'24h: escalation'
```
Yes, it's "long en bouche" (heavy on the palate maybe?).
The timers can be placed in a process variable though.
```ruby
set 'v:reminders' =>
'4h: notice, 8h: notice, 12h: notice, 14h: important, 16h: important, ' +
'18h: important, 19h: urgent, 20h: urgent, 21h: urgent, 22h: urgent, ' +
'22h30m: escalation, 23h: escalation, 23h30m: escalation, ' +
'24h: escalation'
# ...
admin :timers => '${v:reminders}'
```
This is also possible:
```ruby
sequence do
sequence :flank => true do
every '4h', :timeout => '12h' { remind_notice }
every '2h', :timeout => '6h' { remind_important }
every '1h', :timeout => '4h' { remind_urgent }
every '30m', :timeout => '2h' { remind_escalation }
end
admin
end
```
> I wanted a syntax in the form of:
>
> action:[start, end]/frequency; action2:[start, end]/frequency; ...
> actionN:[start, end]/frequency;
>
> Where <action> is the participant being called, <start> is the first
> moment the participant is called, <end> is the last moment the
> participant is called, and frequency being the lap time between each
> notification within the range of <start> and <end>.
>
> So, in the case of the example above:
>
> [...]
> Ruote.define 'our_timers_test' do
> sequence do
> admin_participant :delay => delay, :our_timers => 'notice:[-24h,
> -12h]/4h; important:[-12h, -6h]/2h; urgent[-6h, -2h]/1h;
> escalation:[-2h, 0]/30m;'
> end
> end
> [...]
>
> I've took a look at :timers and the `cron`expression and realized our
> requirements were somewhere in the middle:
> - :timers are an attribute we pass to a participant/subprocess but it
> can only write schedule documents up front; and
What do you mean by "write schedule documents up front"?
> - `cron` expressions are re-evaluated each time they get executed
> `CronExpression::reply -> CronExpression::reschedule` but they are an
> expression, not an attribution.
I think the "every" as seen above might be better suited. Its timeout needs
maybe some kind of margin... (for example, the 12h timeout firing right on
the last notification of the first 12 hours).
> Basically, I'm levering the existing mechanism for timers and I added an
> alias around (Ruote::Exp::FlowExpression::consider_timers) .
>
> I've included my current implementation and my current specs in this gist :
> https://gist.github.com/jfrioux/d1b945e12edb772f61ed#file-timers_spec-rb-L5
>
> My current set of basic specs is passing fine, but I wanted to know,
> since I'm rather a beginner with ruote, if anything in my implementation
> seems off or problematic to you, based on your own mileage.
>
> John, is this something that could be merged to Ruote itself or should
> it be provided as a gem?
I think it makes sense, but I'd prefer and language like
```ruby
admin :timers =>
'0h-12h/4h: notice, 12h-18h/2h: important, 18h-22h/1h: urgent, ' +
'22h-24h/30m: escalation'
```
It'd follow the current "{time stuff}: {participant|subprocess|action}".
What do you think?
--
John Mettraux - http://lambda.io/jmettraux
--
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"ruote" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.