Skip to main content

Tool designed to simplify the management and monitoring of task queues in Python environments

Project description

task-queue-checker

Tool designed to simplify the management and monitoring of task queues in Python environments

Downloads PyPI version Repo Size PyPI - License

Installing

pip install task-queue-checker

Tutorial

import time
import random

from task_queue_checker.storage import PersistQueueSQLite
from task_queue_checker.types import Task
from task_queue_checker import TaskQueueChecker


storage = PersistQueueSQLite()

# add tasks to queue
storage.add([1, 2, 3, "Hola Mundo"])

storage.add({"name": "Raùl", "last_name": "Cobiellas"})

storage.add("Task # 3")

storage.add("Task # 4")


def consumer(task: Task):
    print(task.data)  # task content

    number = random.randint(1, 3)

    if number == 1:
        print(f"task {task.id} done")
        task.done()

    elif number == 2:
        print(f"task {task.id} canceled")
        task.cancel()

    elif number == 3:
        print(f"task {task.id} put last")
        task.put_last()


monitor = TaskQueueChecker(consumer=consumer, task_storage=storage)
# run monitor in background
monitor.start()


# this code simulates the execution of your main program
while True:
    try:
        time.sleep(10)
    except KeyboardInterrupt:
        break

Run tests

python -m pytest -s

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

task_queue_checker-0.0.5.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

task_queue_checker-0.0.5-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file task_queue_checker-0.0.5.tar.gz.

File metadata

  • Download URL: task_queue_checker-0.0.5.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for task_queue_checker-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a837bc8b8787a69464df2d382110323407968524c5c41dd87680970ac323d959
MD5 ebb5864b25ad4d4c61a09b50d99bfda9
BLAKE2b-256 f4431124e5642db8ca97f749078b9d9af818be53ad69fcd238696a4d4eb5351f

See more details on using hashes here.

File details

Details for the file task_queue_checker-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for task_queue_checker-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 573d89c3102c1cc181da351cee6c1865288f28463be42fb2365cd104ff4d4eec
MD5 1ef4be0c049c434cb79158959c331f2c
BLAKE2b-256 0ca5bac939f4e8cf460478230decd3ea821ea26487bfe8c8e888224ff89fe633

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