Skip to main content
Build status License Supported Python versions

rescheduler is a task scheduler built on top of redis. It stores all jobs and schedules in redis which provides persistency (depends on redis persistent level configuration), distributed work (multiple schedulers allowed to be run simultaneously) and fault tolerance (in case of one scheduler crash the others takes away its jobs).

Installation

You can install rescheduler with pip:

$ pip install rescheduler

Quickstart

Server side:

import asyncio
import aioredis
from rescheduler import Scheduler, Job


def tick():
    print("tick")


def tack():
    print("tack")


async def callback(job: Job):
    if job.data['method'] == 'tick':
        tick()

    elif job.data['method'] == 'tack':
        tack()


async def main():
    conn_pool = await aioredis.create_redis_pool(('localhost', 6379))
    async with Scheduler(conn_pool=conn_pool, job_callback=callback, use_keyspace_notifications=True):
        await asyncio.sleep(30)

    conn_pool.close()
    await conn_pool.wait_closed()


if __name__ == '__main__':
    asyncio.run(main())

Client side:

import asyncio
import aioredis
from rescheduler import Scheduler, Job, CronTrigger


async def main():
    conn_pool = await aioredis.create_redis_pool(('localhost', 6379))
    scheduler = Scheduler(conn_pool=conn_pool, job_callback=lambda: None)

    await scheduler.add_job(
        Job(
            id='tick-task',
            trigger=CronTrigger.parse(expr='*/10 * * * * *', seconds_ext=True),
            data={'method': 'tick'},
        )
    )

    await scheduler.add_job(
        Job(
            id='tack-task',
            trigger=CronTrigger.parse(expr='*/10 * * * * *', seconds_ext=True),
            data={'method': 'tack'},
        ),
        delay=5.0,
    )

    conn_pool.close()
    await conn_pool.wait_closed()


if __name__ == '__main__':
    asyncio.run(main())

Metadata

Release files for rescheduler 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rescheduler 0.1.0
File Size Uploaded Provenance
rescheduler-0.1.0.tar.gz 8.7 kB Without provenance Details

Release files / rescheduler-0.1.0.tar.gz

Download URL rescheduler-0.1.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f11f9d4cf7dcbf12d6182fec7348681523943b3f4750193c23ab48820c3872e2
BLAKE2b-256 checksum
How to use checksums
dfdf4a6035215a70dabe1402c260b192f8aa9e46391d8acd192d68d5489a8002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Security for rescheduler 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page