https://github.com/dps/simplescheduler
A simple task scheduler using redis for python
https://github.com/dps/simplescheduler
Last synced: 11 months ago
JSON representation
A simple task scheduler using redis for python
- Host: GitHub
- URL: https://github.com/dps/simplescheduler
- Owner: dps
- License: bsd-2-clause
- Created: 2015-04-11T09:50:32.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-13T19:41:30.000Z (about 11 years ago)
- Last Synced: 2025-06-20T14:58:27.029Z (about 1 year ago)
- Language: Python
- Size: 168 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simplescheduler
[](https://secure.travis-ci.org/dps/simplescheduler)
A simple task scheduler using redis for python.
I have tried some of the more popular task schedulers for python, including rq + rqscheduler and apscheduler but had problems making them work reliably in production.
Simple scheduler is simple. It's dumb. But it works, and it's so simple that if it does go wrong, you can probably debug it yourself.
## Getting started
First, run a Redis server:
```console
$ redis-server
```
To run jobs later, just define your blocking function:
```python
in myfile.py
def job(message):
print 'job done: %s' % message
```
Then, create a job, scheduler instance and schedule the job:
```python
from datetime import timedelta
from simplescheduler import Job, Scheduler
j = Job('myfile.job', ['example parameter'])
s = Scheduler()
s.schedule_in(j, timedelta(hours=1))
```
### The worker
To start executing scheduled function calls in the background, set environment variables corresponding to your redis instance and start a worker from your project's directory:
```console
$ export REDIS_HOST=localhost
$ export REDIS_PORT=6397
$ export REDIS_DB=0
$ export REDIS_KEY=
$ ss
Start ss:sched:1428788600124490
```
## Installation
Simply use the following command to install the latest released version:
pip install simplescheduler