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

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.0.tar.gz (7.2 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.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: orunnerpool-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 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.0.tar.gz
Algorithm Hash digest
SHA256 55e844d10a62bd01fdbaf54f98daf1ea16bf0d9d98bdf701900c3540336e14a1
MD5 3727853e119b8e4fd73df59d90658ea7
BLAKE2b-256 85353615de8fd7bb9d246007388182f4f5203e148a5fc1e32fb181639af640fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: orunnerpool-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3b53e8e2f0da1713ec1283a9a7bc8447e35b73aec064ff581c98aff32e3fe1d
MD5 27a534a244f4dba6d2d448a821daaaff
BLAKE2b-256 f1bbcff84d991dfce71f1e44e84ae3ca002bb3c75a712468fa61e47781a6e877

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