Skip to main content

A high-performance, asynchronous, ready for production task scheduling framework written in Python.

Project description

TaskShed

A high-performance, asynchronous, ready for production job scheduling framework.

TaskShed provides a simple API to schedule your Python coroutines for later execution. You can run tasks just once or on a recurring interval. The scheduler is dynamic, allowing you to add, update or remove tasks on the fly. Furthermore, by connecting to a persistent datastore, TaskShed ensures your tasks survive restarts and automatically catches up on any executions that were missed while the system was offline.

The key features are:

  • Fast: TaskShed has a very low latency, overhead and can execute several thousands tasks a second.
  • Distributed: TaskShed has the capacity to spawn several workers and schedules across many machines, while also providing optimisation for monolinth architectures.
  • Persistant: Tasks are stored in database, meaning that they won't get dropped on shutdown. TaskShed currently supports Redis and MySQL.
  • Easy: TaskShed's modular architecture is straightforward and easy to set-up, and works in any asynchronous environement.

Installation 🔧

Install the core package using pip:

pip install taskshed

TaskShed has no extra dependencies beyond its core framework. However, if you want persistent task storage, you’ll need to install one of the optional backends. TaskShed currently supports Redis and MySQL. You can install the appropriate driver using:

pip install "taskshed[redis]"

or

pip install "taskshed[mysql]"

Quick Start 🏁

Here's a simple example of scheduling a task to run in 5 seconds.

from datetime import datetime, timedelta
from taskshed.datastores import InMemoryDataStore
from taskshed.schedulers import AsyncScheduler
from taskshed.workers import EventDrivenWorker


async def say_hello(name: str):
    print(f"Hello, {name}!")


datastore = InMemoryDataStore()
worker = EventDrivenWorker(callback_map={"say_hello": say_hello}, datastore=datastore)
scheduler = AsyncScheduler(datastore=datastore, worker=worker)


async def main():
    await scheduler.start()
    await worker.start()
    await scheduler.add_task(
        callback="say_hello",
        run_at=datetime.now() + timedelta(seconds=3),
        kwargs={"name": "World"},
    )


if __name__ == "__main__":
    import asyncio

    loop = asyncio.new_event_loop()
    loop.create_task(main())
    loop.run_forever()

Documentation 📚

https://chase-labs.github.io/taskshed/

Contributing 🤝

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License 📜

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

taskshed-0.9.1.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

taskshed-0.9.1-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file taskshed-0.9.1.tar.gz.

File metadata

  • Download URL: taskshed-0.9.1.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for taskshed-0.9.1.tar.gz
Algorithm Hash digest
SHA256 40ed1da0f5ea7e5b0748c977034d08297cdfbdda4f12b8aed27c9afc004c231b
MD5 d9ba8fe8c2f206f5a3f53abd8ead6c68
BLAKE2b-256 74ce9cb1390bb85d5bbf83c68b96e498e1038666c74596ab22fb9fb9c15ecc75

See more details on using hashes here.

File details

Details for the file taskshed-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: taskshed-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for taskshed-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cbae2bef95b19314f631cf0b997d1744799d783190ea43e662c96f0d7a02600d
MD5 53ebd25286de5e43cff5f1e49fbb492f
BLAKE2b-256 d11a45119b251189ee047ffc6fdc18d452ec4dd9a164d1fbbc55b1b22a8911fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page