Skip to main content

Map colonies priority queue management service for records

Project description

Map colonies - priority queue management package


Overview

Pyority-Queue - python priority queue package provides ability to manage queue by handle tasks statuses and report tasks liveness.


Installation:


From PyPi

 $ pip install mc-pyority-queue


Getting Started


Import & Initialize

from mc-pyority-queue.task_handler import TaskHandler

task_handler = TaskHandler('job_type', 'task_type',
    'http://localhost:8081', 'http://localhost:8080/heartbeat', 1.0)

above example uses TaskHanler class and initializing it follow the request params:

task_handler = TaskHandler(job_type, task_type, job_mngr_url, heartbeat_url, interval_ms, logger)


  • Dequeue
from mc-pyority-queue.task_handler import TaskHandler

async def main():
    task_handler = TaskHandler('job_type', 'task_type',
    'http://localhost:8081', 'http://localhost:8080/heartbeat', 1.0, logger_instance)

    await task_hanlder.dequeue(interval_ms)


loop = asyncio.get_event_loop()
task = loop.run_until_complete(main())

consume task from the job manager service and start send heartbeat to the heartbeat service


  • Reject
 await task_hanlder.reject(job_id, task_id, is_recoverable, reason)

reject handle error by stop sending task's heartbeat and handle task's status - depends if task is recoverable or not.


  • ack
await task_hanlder.ack(job_id, task_id)

ack handle completed task - stops sending task's heartbeat and handle complete task status


  • update_progress
await task_hanlder.update_progress(job_id, task_id, percentage)

handle task progress - sends job manager updated percentage on progress

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

mc_pyority_queue-0.0.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file mc_pyority_queue-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: mc_pyority_queue-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.9

File hashes

Hashes for mc_pyority_queue-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac3f99f0e1ffc2d2e8b645486eb9f7be168963d95a8cfd999fedcf8f20714dd7
MD5 c74d1a43549e3b70df83d2e5971112c5
BLAKE2b-256 780ed09cba6e8673902aa118433a1f964655c9a57b250b61a890f473fc1b0dc5

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