Metadata-Version: 2.4
Name: llama-scheduler
Version: 0.1.0
Summary: General-purpose job scheduling service for the LlamaAI Ecosystem.
Project-URL: Homepage, https://github.com/yourusername/llama-scheduler-pkg
Project-URL: Bug Tracker, https://github.com/yourusername/llama-scheduler-pkg/issues
Project-URL: Documentation, https://yourusername.github.io/llama-scheduler-pkg/
Author-email: Your Name <your.email@example.com>
License: MIT License
        
        Copyright (c) 2024 Your Name # Replace with current year and your name/organization
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE. 
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.8
Requires-Dist: apscheduler>=3.10.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: loguru>=0.7.0
Requires-Dist: pydantic>=1.10.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: pyyaml>=6.0
Provides-Extra: all
Requires-Dist: black>=23.3.0; extra == 'all'
Requires-Dist: celery>=5.3.0; extra == 'all'
Requires-Dist: freezegun>=1.2.0; extra == 'all'
Requires-Dist: httpx; extra == 'all'
Requires-Dist: isort>=5.12.0; extra == 'all'
Requires-Dist: mkdocs-material>=9.1.6; extra == 'all'
Requires-Dist: mkdocs>=1.4.2; extra == 'all'
Requires-Dist: mkdocstrings[python]>=0.20.0; extra == 'all'
Requires-Dist: mypy>=1.2.0; extra == 'all'
Requires-Dist: pre-commit>=3.3.1; extra == 'all'
Requires-Dist: pytest-asyncio; extra == 'all'
Requires-Dist: pytest-cov>=4.1.0; extra == 'all'
Requires-Dist: pytest-mock>=3.10.0; extra == 'all'
Requires-Dist: pytest>=7.3.1; extra == 'all'
Requires-Dist: redis[hiredis]>=4.5.0; extra == 'all'
Requires-Dist: ruff>=0.0.260; extra == 'all'
Provides-Extra: celery
Requires-Dist: celery>=5.3.0; extra == 'celery'
Provides-Extra: dev
Requires-Dist: black>=23.3.0; extra == 'dev'
Requires-Dist: freezegun>=1.2.0; extra == 'dev'
Requires-Dist: httpx; extra == 'dev'
Requires-Dist: isort>=5.12.0; extra == 'dev'
Requires-Dist: mypy>=1.2.0; extra == 'dev'
Requires-Dist: pre-commit>=3.3.1; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.10.0; extra == 'dev'
Requires-Dist: pytest>=7.3.1; extra == 'dev'
Requires-Dist: ruff>=0.0.260; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.1.6; extra == 'docs'
Requires-Dist: mkdocs>=1.4.2; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.20.0; extra == 'docs'
Provides-Extra: redis
Requires-Dist: redis[hiredis]>=4.5.0; extra == 'redis'
Description-Content-Type: text/markdown

# llama-scheduler

[![PyPI version](https://img.shields.io/pypi/v/llama_scheduler.svg)](https://pypi.org/project/llama_scheduler/)
[![License](https://img.shields.io/github/license/llamasearchai/llama-scheduler)](https://github.com/llamasearchai/llama-scheduler/blob/main/LICENSE)
[![Python Version](https://img.shields.io/pypi/pyversions/llama_scheduler.svg)](https://pypi.org/project/llama_scheduler/)
[![CI Status](https://github.com/llamasearchai/llama-scheduler/actions/workflows/llamasearchai_ci.yml/badge.svg)](https://github.com/llamasearchai/llama-scheduler/actions/workflows/llamasearchai_ci.yml)

**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

```bash
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.)*

```bash
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.)*

```python
# 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

```mermaid
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

```bash
# 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

```bash
pytest tests/
```

### Contributing

Contributions are welcome! Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) and submit a Pull Request.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
