Skip to main content
  1. Posts/

FastScheduler: Decorator-First Python Task Scheduler with Async Support

··249 words·2 mins·

⏰ Tired of Celery for simple tasks? FastScheduler solves it in one line.

FastScheduler is a lightweight Python scheduler with a decorator-based API, native async support, cron expressions, and a real-time dashboard. Install with: pip install fastscheduler.

🎯 Scheduling in one line:

from fastscheduler import FastScheduler
scheduler = FastScheduler(quiet=True)

@scheduler.every(10).seconds
def heartbeat():
    print("ping")

@scheduler.daily.at("09:00", tz="America/New_York")
async def morning_report():
    await send_report()

@scheduler.cron("*/15 * * * *")
def check_api():
    ping_health_endpoint()

scheduler.start()

πŸ“‹ Everything included:

FeatureDetail
⚑ Native asyncasync def works with zero extra config
🌍 TimezonesAny timezone with .tz("America/New_York")
πŸ“… Cron expressionsComplex schedules with standard syntax
πŸ”„ Auto retriesExponential backoff (2s, 4s, 8s…)
⏱️ TimeoutsKill jobs that run too long
πŸ’Ύ Persistent stateSurvives restarts, handles missed jobs
πŸ“¬ Dead Letter QueueFailed job history with full error details

πŸ–₯️ Built-in FastAPI dashboard:

from fastscheduler.fastapi_integration import create_scheduler_routes
app.include_router(create_scheduler_routes(scheduler))
# Dashboard at: http://localhost:8000/scheduler/

πŸ” Explanation in a nutshell

A “scheduler” is a program that automatically runs tasks at specific times β€” like an alarm clock for your code. For example: “run this function every day at 9 AM” or “check the API every 15 minutes.” FastScheduler does this in Python by simply adding @scheduler.every(10).seconds above any function, with no extra servers to configure.

More information at the link πŸ‘‡

Also published on LinkedIn.
Juan Pedro Bretti Mandarano
Author
Juan Pedro Bretti Mandarano