Skip to main content

General-purpose job scheduling service for the LlamaAI Ecosystem.

Project description

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.

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

llama_scheduler-0.1.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

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

llama_scheduler-0.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file llama_scheduler-0.1.0.tar.gz.

File metadata

  • Download URL: llama_scheduler-0.1.0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for llama_scheduler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e6de5179677e3a1d03dd98caa35a162efb6525f43c6c9e42d662a413f0628ec3
MD5 c0e930d6ed621de163c9caaa1ee7823c
BLAKE2b-256 b15b167b06f699c3143b3228a03b3a6b5617b6cfa1f0749a9bafb08dbdf55a80

See more details on using hashes here.

File details

Details for the file llama_scheduler-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_scheduler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6348b999e98aed3fb1fc9bf8ef413a8f1604f6575b865290975b961264a7548
MD5 97e0b47e48e55a516e6a5e4a62627fbe
BLAKE2b-256 56d54074ecfde67d85bcb96ac470bb1c47de714e14a38b5ed11b872d3d58fa98

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