Erlang/OTP Forums

Author Message

<  User Contributions  ~  Timed supervisor for scheduled process execution

asergey
Posted: Tue Sep 23, 2008 12:17 pm Reply with quote
User Joined: 12 Mar 2005 Posts: 313
This module implements a supervisor that can manage a single child process by allowing to define:

1. Days of week and hours of day when the child process needs to be run.
2. Extended restart handling that includes max number of restarts in a given interval with a given restart delay.
3. Child process can run on another node.
4. Allowing to use a monitor or link to monitor child process (sometimes it may be needed not to restart a child process running on another node if a connection to the node running the timed_supervisor fails. In this case the {M,F,A} needs to be "smart enough" not to start a new child but to resume monitoring existing child Pid when network connection gets restored).
5. Ability to specify failure action (e.g. restart, reschedule for next time interval, custom function, etc.)
6. Extended progress reports and supervisor reports showing child process scheduling status.

Example:

Run {M,F,A} event Mon & Tue between 9am and 5pm, allowing up to 3 failures within 20 seconds with a restart delay of 4s:

timed_supervisor:start_link(
{M,F,A}, [{schedule, [{[mon,tue], [{"9:00:00", "17:00:00"}]}]},
{restart, {3, 20, 4}}])

Regards,

Serge



timed_supervisor.erl
 Description:

Download
 Filename:  timed_supervisor.erl
 Filesize:  40.91 KB
 Downloaded:  1316 Time(s)

View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum