Skip to main content

VM Allocator Service Package for Lablink

Project description

lablink-allocator-service

VM allocator service for the LabLink system.

PyPI version Python 3.9+ License

This package provides the core Flask-based web application that manages VM allocation, assignment, and lifecycle for computational research workflows.


Features

  • 🌐 Web Interface: Request and manage VMs via web dashboard
  • 🔄 Dynamic Allocation: Automatically assign VMs to users based on availability
  • 📊 PostgreSQL Database: Track VM status, assignments, and health
  • 🔐 Authentication: Basic HTTP auth for admin endpoints
  • ☁️ AWS Integration: Integrates with AWS EC2 via infrastructure templates
  • 🐳 Docker Support: Run any containerized research software
  • 🔍 Real-time Monitoring: Track VM health and status
  • 🌐 Optional DNS: Support for custom domain configuration

Installation

From PyPI

pip install lablink-allocator-service

With uv (Recommended)

uv pip install lablink-allocator-service

Quick Start

Basic Usage

from lablink_allocator_service import main

# Run the Flask application
if __name__ == "__main__":
    main.app.run(host="0.0.0.0", port=5000)

Configuration

Configuration is managed via Hydra with conf/config.yaml:

db:
  dbname: "lablink"
  user: "lablink"
  password: "your_password"
  host: "localhost"
  port: 5432

app:
  admin_user: "admin"
  admin_password: "secure_password"
  region: "us-west-2"

machine:
  instance_type: "g4dn.xlarge"
  docker_image: "your-registry/your-image:tag"

See the Configuration Guide for detailed options.


Development

Setup

# Clone the repository
git clone https://github.com/talmolab/lablink.git
cd lablink/lablink-allocator/lablink-allocator-service

# Install with development dependencies
uv sync --extra dev

# Run tests
uv run pytest

# Run with coverage
uv run pytest --cov=src/lablink_allocator_service

# Run linting
uv run ruff check src tests

Project Structure

lablink-allocator-service/
├── src/
│   └── lablink_allocator_service/
│       ├── main.py              # Flask application
│       ├── database.py          # Database operations
│       ├── conf/                # Configuration files
│       ├── templates/           # HTML templates
│       └── utils/               # Utility modules
├── tests/                       # Test suite
├── pyproject.toml               # Package configuration
└── README.md                    # This file

API Endpoints

Public Endpoints

  • GET / - Home page
  • POST /request_vm - Request VM assignment
  • GET /admin - Admin dashboard (requires auth)

Internal Endpoints

  • POST /vm_startup - Client VM registration
  • POST /vm_update - Client VM status updates

See the API Reference for complete documentation.


Deployment

This package is designed to be deployed as part of the LabLink infrastructure. For deployment instructions, see the LabLink Template Repository (coming soon).

Docker Deployment

The allocator service is containerized and published to GHCR. See lablink-allocator for the Docker image.


Documentation


Contributing

Contributions are welcome! Please see the Contributing Guide for details.

Quick Contribution Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Make changes and add tests
  4. Run tests: uv run pytest
  5. Run linting: uv run ruff check src tests
  6. Commit: git commit -m "feat(allocator): add my feature"
  7. Push and open a Pull Request

Changelog

See the Allocator Changelog for release history.


License

BSD-3-Clause License. See LICENSE for details.


Links


Questions? Check the FAQ or open an issue.

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

lablink_allocator_service-0.0.2a0.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

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

lablink_allocator_service-0.0.2a0-py3-none-any.whl (41.6 kB view details)

Uploaded Python 3

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