Skip to main content

llama-scheduler

PyPI version License Python Version CI Status

Llama Scheduler (llama-scheduler) provides job scheduling capabilities within the LlamaSearch AI ecosystem. It allows defining, scheduling, and managing recurring or one-off tasks.

Key Features

  • Job Scheduling: Core engine for scheduling tasks based on time or events (scheduler.py).
  • Job Definitions: Allows defining the functions or tasks to be executed (job_functions.py).
  • Configuration Schema: Defines the structure for configuring jobs and schedules (config_schema.py).
  • Command-Line Interface: Provides tools to manage schedules and jobs via CLI (cli.py).
  • Core Module: Manages the scheduler lifecycle and job execution (core.py).
  • Configurable: Allows defining schedules, job parameters, and backend settings (config.py).

Installation

pip install llama-scheduler
# Or install directly from GitHub for the latest version:
# pip install git+https://github.com/llamasearchai/llama-scheduler.git

Usage

Command-Line Interface (CLI)

(CLI usage examples for adding, removing, and listing scheduled jobs will be added here.)

llama-scheduler add-job --name "daily-report" --schedule "0 8 * * *" --task "generate_report"
llama-scheduler list-jobs

Python Client / Embedding

(Python usage examples for programmatically scheduling jobs will be added here.)

# Placeholder for Python client usage
# from llama_scheduler import Scheduler, Job
# from my_tasks import backup_database # Assuming backup_database is in job_functions or imported

# scheduler = Scheduler(config_path="config.yaml")

# # Define a job
# backup_job = Job(
#     name="database_backup",
#     func=backup_database,
#     trigger="cron",
#     hour=2, # Run at 2 AM daily
#     args=["/path/to/backup/dir"]
# )

# # Add and start the job
# scheduler.add_job(backup_job)
# scheduler.start()

Architecture Overview

graph TD
    A[User / CLI (cli.py)] --> B{Core Module (core.py)};
    B --> C{Scheduler Engine (scheduler.py)};
    C -- Loads Job Definitions --> D[Job Functions (job_functions.py)];
    C -- Reads Schedule --> E{Job Store / Schedule DB};
    C -- Triggers Job --> F[Job Executor];
    F -- Executes --> D;

    G[Configuration (config.py, config_schema.py)] -- Configures --> B;
    G -- Configures --> C;
    G -- Defines Schema for --> E;

    style C fill:#f9f,stroke:#333,stroke-width:2px
    style E fill:#ccf,stroke:#333,stroke-width:1px
  1. Interface: Users interact via the CLI or potentially a programmatic API managed by the Core Module.
  2. Core Module: Handles requests and controls the scheduler engine.
  3. Scheduler Engine: The heart of the system, responsible for tracking time/events and triggering jobs based on the schedule.
  4. Job Store: Stores the defined jobs and their schedules (could be in memory, a file, or a database).
  5. Job Functions: Contains the actual Python code that gets executed for each job.
  6. Executor: The component responsible for running the job function when triggered.
  7. Configuration: Defines the schedule, job parameters, backend storage, etc.

Configuration

(Details on configuring job schedules (cron syntax, intervals), job parameters, backend persistence, etc., will be added here.)

Development

Setup

# Clone the repository
git clone https://github.com/llamasearchai/llama-scheduler.git
cd llama-scheduler

# Install in editable mode with development dependencies
pip install -e ".[dev]"

Testing

pytest tests/

Contributing

Contributions are welcome! Please refer to CONTRIBUTING.md and submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for llama-scheduler 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 llama-scheduler 0.1.0
File Size Uploaded
llama_scheduler-0.1.0.tar.gz 21.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-scheduler 0.1.0
File Interpreter ABI Platform
llama_scheduler-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.5 kB

Release files / llama_scheduler-0.1.0.tar.gz

Download URL llama_scheduler-0.1.0.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e6de5179677e3a1d03dd98caa35a162efb6525f43c6c9e42d662a413f0628ec3
BLAKE2b-256 checksum
How to use checksums
b15b167b06f699c3143b3228a03b3a6b5617b6cfa1f0749a9bafb08dbdf55a80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / llama_scheduler-0.1.0-py3-none-any.whl

Download URL llama_scheduler-0.1.0-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6348b999e98aed3fb1fc9bf8ef413a8f1604f6575b865290975b961264a7548
BLAKE2b-256 checksum
How to use checksums
56d54074ecfde67d85bcb96ac470bb1c47de714e14a38b5ed11b872d3d58fa98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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