Skip to main content

CourseMapper Worker

Project description

CourseMapper Worker

This package is to be used with CourseMapper.

Its purpose it to provide a simple method for interacting with the worker queue of CourseMapper.

Its handles reading from the 'waiting' queue, pushing results to the 'done', sending periodic 'live' updates, and sending log messages.

Installation

pip install git+https://github.com/jeanqussa/cm-worker

Usage

This is a simple program that watches the 'addition' job queue, adds two numbers, and returns the result.

from cm_worker import Worker
from config import Config

worker = Worker(Config.REDIS_HOST, Config.REDIS_PORT, Config.REDIS_DB, Config.REDIS_PASSWORD)
worker.log_to_console = True

def execute_job(job):
    value_a = job.get('a')
    value_b = job.get('b')
    return value_a + value+b

worker.add_pipeline('addition', execute_job)

worker.start()

Take a look at the public methods of the Worker class for more use cases.

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

cm_worker-0.0.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

cm_worker-0.0.4-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file cm_worker-0.0.4.tar.gz.

File metadata

  • Download URL: cm_worker-0.0.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

File hashes

Hashes for cm_worker-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7da52e6485d4350d83b06e5e12aed23bd94e6ad2593edf4a26b994db726c1c94
MD5 fe8a78681c0040a20bca522501f21685
BLAKE2b-256 2e1135e5ecafe497e4d57f1a004d635f4409507ba2ed324272f821bc007061a4

See more details on using hashes here.

File details

Details for the file cm_worker-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: cm_worker-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

File hashes

Hashes for cm_worker-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6bb932c21c5af54b145a2315c2ed359907f1324d48d7c91b58087bfcef536eb7
MD5 2262eedceeadba8fe08cf0f40dd666b1
BLAKE2b-256 5990913c9aa70cb3e652c9f3807f4bba7620d8b5a11d0a2deb94ae975a1827d9

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