Skip to main content

Heavy-job queue processor

Project description

Heavy-job queue processor

Installation

pip install shire

Create config file

Run shire-cli create_config, follow instructions.

An example of the shire.cfg:

[connection]
redis_url = redis://127.0.0.1:6379/0
db_url = postgres://peewee:123@127.0.0.1:5432/peewee

[hostler]
check_time = 5

[shire]
venv_path = /path/to/your/virtualenv
sys_path = /path/to/your/project:/path/to/external/library
host = default

[scribe]
per_pool = 1
log_max_size = 104857600
log_directory = logs
max_logs = 5
default_log = default.log

[pool]
check_time = 30

[whip]
limits_update_time = 60
check_time = 1

Queue management

Interactive shire config creation

shire-cli -c /path/to/your/shire.cfg create_config

Run whip (Enqueue jobs to pools)

shire-cli -c /path/to/your/shire.cfg run_whip

Run scribe (Shire job logs writer)

shire-cli -c /path/to/your/shire.cfg run_scribe

Run hostler (Shire failed jobs restarter)

shire-cli -c /path/to/your/shire.cfg run_hostler

Run pool (Shire job executor)

shire-cli -c /path/to/your/shire.cfg run_pool –name=pool_name

Run multiple pools with one master-process

shire-cli -c /path/to/your/shire.cfg start_pools –names=pool_name,another_pool

Example

Run shire

shire-cli -c /path/to/your/shire.cfg run_whip shire-cli -c /path/to/your/shire.cfg run_pool –name=default

Create example jobs module:

# my_jobs.py
from shire.job import Job
import requests

def save(text_len):
    # save - your external function to save result data. Shire not save any results itself.
    pass

class CountWordsAtUrl(Job):
    def run(url=None):
        resp = requests.get(url)
        save(len(resp.text.split()))

Create example configuration module:

# shire_conf.py
from shire.config import Config as ShireConfig
conf = ShireConfig()
conf.load('/path/to/your/shire.cfg')

Enqueue job:

from my_jobs import CountWordsAtUrl
from shire_conf import conf
CountWordsAtUrl.delay(conf, pool='default', kwargs={'url': 'https://github.com/suguby/shire'})

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

shire-0.2.1.tar.gz (20.8 kB view details)

Uploaded Source

File details

Details for the file shire-0.2.1.tar.gz.

File metadata

  • Download URL: shire-0.2.1.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for shire-0.2.1.tar.gz
Algorithm Hash digest
SHA256 115ba0f78b935454ae0fb78889089944e1756155a65f78b26fc0de3e2c78a00a
MD5 accfccb5b481e0065628afa42875091c
BLAKE2b-256 560128457870d196afb505ee88f6957a564d30a5c9d13c7698ed2288967a7542

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page