Package emma :: Module sched
[hide private]
[frames] | no frames]

Module sched

source code

Schedule actions or events


Copyright: (c) 2011 hackmeeting http://sindominio.net/hackmeeting

Author: Ruben Pollan

Organization: hackmeeting http://sindominio.net/hackmeeting

Contact: meskio@sindominio.net

License: This program is free software; you can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://sam.zoy.org/projects/COPYING.WTFPL for more details.

Functions [hide private]
 
str2date(date)
Convert an string of date to a epoch date
source code
 
periodic(handler, seconds)
Program a periodic action
source code
 
_periodic(handler, seconds) source code
 
at(event, data, date, doc_id=None)
Program an event to be trigger on a date
source code
 
delay(event, data, seconds, doc_id=None)
Program an event to be trigger after some seconds
source code
 
_delay(event, data, seconds, date, doc_id=None) source code
Function Details [hide private]

str2date(date)

source code 

Convert an string of date to a epoch date

Parameters:
  • date (string) - string date of the date
Returns:
epoch date

periodic(handler, seconds)

source code 

Program a periodic action

Execute handler each seconds in parallel.

Parameters:
  • handler (fun()) - function to call each seconds
  • seconds (integer) - waiting seconds between the end of a handler call and the next

at(event, data, date, doc_id=None)

source code 

Program an event to be trigger on a date

Parameters:
  • event (Event) - event to be scheduled
  • data - data for the event
  • date (int or string) - epoch date or string date for the event
  • doc_id (ObjectId) - optional database document id where is stored the scheduled event. Meant to be use on recovering sched from the database, like after a shutdown

delay(event, data, seconds, doc_id=None)

source code 

Program an event to be trigger after some seconds

Parameters:
  • event (Event) - event to be scheduled
  • data - data for the event
  • seconds (int) - seconds of delay for the event
  • doc_id (ObjectId) - optional database document id where is stored the scheduled event. Meant to be use on recovering sched from the database, like after a shutdown

Warning: it is not properly tested might have bugs