skip to navigation
skip to content

Not Logged In

pyriodic 0.2

A scheduler written in Python using dateutil for periodic jobs.

Latest Version: 0.2.4

===
pyriodic
===

**pyriodic** is a scheduler written in Python using dateutil to run periodic jobs.

This project was just started and is in the alpha stage so there is a lot yet to do.
It is coded in Python 3.3; other versions of Python have yet to be tested.

Usage
=====

Schedule recurring jobs by specifying at least a desired **interval** as a string.

Example
-------
::
from datetime import datetime
from pyriodic.pyriodic import Scheduler, HOURLY, MINUTELY

print('Program starting at', datetime.now())
sched = Scheduler()
message = 'Hello from argumentland.'

def run_test1(mes):
print('This is test 1.', mes, datetime.now())

sched.add_recuring_job(run_test1, args=(message,), interval=HOURLY)

# or use a decorator!
@sched.schedule_recuring_job(interval=MINUTELY, start_time='12:30:45 PM')
def run_test2():
print('This is test 2.', datetime.now())

run_test2()

Output
------

Program starting at 2014-05-24 21:19:34.029764

This is test 1. Hello from argumentland. 2014-05-24 21:19:34.528792

This is test 1. Hello from argumentland. 2014-05-24 21:20:00.000249

This is test 2. 2014-05-24 21:20:15.000107

This is test 1. Hello from argumentland. 2014-05-24 21:20:59.999681

This is test 2. 2014-05-24 21:21:14.999539

Intervals included are:
* yearly (haven't had the **time** to test this one out yet)
* monthly (nor this one)
* daily
* hourly
* minutely
* secondly

Other parameters include:
* *string* **start_date** (defaults to today's date)
* *string* **start_time** (defaults to midnight)
* *integer* **how_many** intervals to run (default is infinite)
* *integer* **retrys** upon exceptions (default is 3 times)
* *integer* **retry_delay** seconds to delay next run time after exception (default is 10 seconds right now)
* *string* **name** the name that the job can then be refered to as (defaults to function name)

Start dates and times are parsed by dateutil so it is flexible in what it excepts.

Todo
====

1. Add support for Weekly Intervals
1. Add day_of_week option (currently there but doesn't do anything yet)
2. Add ``weekly`` to the list of accepted intervals
2. Add timezone awareness
3. Add logging capability
4. Add more options for error handling
1. Add option for a waiting time before the next function call after an exception - Done!
2. Add option for the number of retrys after exceptions - Done!
3. Maybe add the option to execute a different function upon an exception
5. Add docstrings
6. Add options for retrieving the return values
1. Add capturing of return variables into an OrderedDict (keys are the datetime that the return value was captured) for each job - Done!
2. Add option for maximum number of stored return values
7. Named Jobs - Done!

Changelog
=========

Version 0.2
-----------
* Organized code a bit
* Added named jobs
* Added rudimentary capability to retrieve the return values from each job
* Added ability to limit job to x number of failures and to set the delay after an exception

Version 0.1
-----------
* Initial Release  
File Type Py Version Uploaded on Size
pyriodic-0.2.zip (md5) Source 2014-05-26 4KB
  • Downloads (All Versions):
  • 97 downloads in the last day
  • 525 downloads in the last week
  • 554 downloads in the last month