Skip to main content

Worker client for the ORunner Pool project

Project description

ORunner Pool - Worker Client

[!WARNING] This project is in a very early status. Consider it a _working_✨ proof of concept.

This is the worker component of the ORunner Pool project. It runs on contributor machines to serve Ollama models to the pool.

Prerequisites

Installation

  1. Clone the repository or download the worker files:

    git clone https://github.com/aaronfc/orunnerpool-worker.git
    cd orunnerpool-worker
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    
  3. Create your configuration file:

    cp config.ini.example config.ini
    
  4. Edit the config.ini file with your settings:

    [auth]
    # Your API key from the Ollama Runner Pool web interface
    api_key = your_api_key_here
    
    [pool]
    # URL of the pool API
    # If using Docker Compose for development, use http://localhost:8000
    # For production, use https://api.orunnerpool.com
    api_url = https://api.orunnerpool.com
    
    [worker]
    # Name of this worker (shown in the web interface)
    name = My Ollama Worker
    # Heartbeat interval in seconds
    heartbeat_interval = 30
    # Task polling interval in seconds
    poll_interval = 5
    
    [ollama]
    # URL of your local Ollama instance
    url = http://localhost:11434
    

Usage

  1. Make sure Ollama is running on your machine:

    ollama serve
    
  2. Start the worker:

    python worker.py
    

    Or specify a custom config file location:

    python worker.py --config /path/to/your/config.ini
    
  3. The worker will automatically:

    • Discover available models on your Ollama instance
    • Register with the pool
    • Send regular heartbeats
    • Poll for tasks and process them

Logs

The worker logs to stdout by default. You can redirect the output to a file:

python worker.py > worker.log 2>&1

Running as a Service

[!WARNING] These steps are not tested yet.

Systemd (Linux)

Create a systemd service file:

sudo nano /etc/systemd/system/ollama-worker.service

Add the following content:

[Unit]
Description=Ollama Runner Pool Worker
After=network.target

[Service]
User=yourusername
WorkingDirectory=/path/to/worker
ExecStart=/usr/bin/python3 /path/to/worker/worker.py
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl enable ollama-worker
sudo systemctl start ollama-worker

Launchd (macOS)

Create a plist file:

nano ~/Library/LaunchAgents/com.ollama.worker.plist

Add the following content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.ollama.worker</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/python3</string>
        <string>/path/to/worker/worker.py</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>WorkingDirectory</key>
    <string>/path/to/worker</string>
    <key>StandardOutPath</key>
    <string>/path/to/worker/worker.log</string>
    <key>StandardErrorPath</key>
    <string>/path/to/worker/worker.log</string>
</dict>
</plist>

Load the service:

launchctl load ~/Library/LaunchAgents/com.ollama.worker.plist

Troubleshooting

Worker fails to register

  • Make sure Ollama is running and has at least one model loaded
  • Check that your API key is correct
  • Verify the pool API URL is accessible

Worker can't connect to Ollama

  • Ensure Ollama is running (ollama serve)
  • Check the Ollama URL in your config file
  • Verify there are no firewall rules blocking access to port 11434

Worker doesn't receive tasks

  • Check that your worker is registered successfully
  • Verify that your models are correctly listed in the pool
  • Make sure your worker's heartbeat is being received by the pool

Releasing

  • Build with python -m build.
  • Publish to TestPyPI twine upload --repository-url https://test.pypi.org/legacy/ dist/*.

Contributing

Contributions are welcome! Please feel free to 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

orunnerpool-0.1.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

orunnerpool-0.1.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file orunnerpool-0.1.1.tar.gz.

File metadata

  • Download URL: orunnerpool-0.1.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for orunnerpool-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9ae3f53e9366e29d83799e59065369ec1846bba693b3bd9972c9673a5bb0e789
MD5 f830bf8b26c52d87230fccaef5e20d9f
BLAKE2b-256 c1510f5bf3e3e94f3db79d5b9f457a4dc0fe137f8556a7859e7c131824197fa2

See more details on using hashes here.

File details

Details for the file orunnerpool-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: orunnerpool-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for orunnerpool-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87ed212d0f1a8ce33d154fa87ab0143b0ae18a5c3267e1e7bd6b37ad6a8baf56
MD5 bf44ff0700ec5c38a60c0dbc1a851cb8
BLAKE2b-256 a7b023c65218b5bb567f4354d685f0e780ce3306f16f7c78a8cee553ecdc8456

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