Skip to main content

Django-based job queue

Project description

parviraptor

parviraptor is a Django app for managing queue-based jobs, both sequentially and in parallel.

This package provides

  • abstract base classes and factories for modelling Django Model based job queues

  • capabilities of supporting jobs' interdependencies

  • a management command for processing job queues

  • rudimentary Django views for monitoring and job queue statistics

Compatibility

parviraptor should be compatible with any Django codebase. The test suite covers Django 3.2, 4.0, 4.1 and 4.2 with each MySQL 5 and 8, the latter depending on which MySQL versions Django supports.

Running tests

Tests and lints are covered by just test, you can separately lint using the command just lint.

Development

For developing parviraptor it is necessary to have nix 2.x and direnv 2.x installed as system-wide dependencies. nix must have enabled the features "nix command" and "flake support".

The development shell can be invoked by e.g. direnv exec . zsh. Executing this for the first time might require to run direnv allow. Shorthand commands, for example those mentioned in chapter "Running tests", can be enumerated using just --help.

In order to test whether the package would be built correctly, you can run python setup.py build in the development shell to inspect whether build/lib/parviraptor/ looks as expected.

Installation

Just add 'parviraptor' to your INSTALLED_APPS Django setting as usual.

API outline

  • parviraptor.models.AbstractJobFactory is a factory generating job base classes. For details, see the class documentation itself. Also, you can spy into tests/models.py to see job class examples which have (or don't have) interdependencies.

  • parviraptor implements rudimentary views for monitoring (/queue-monitoring) and statistics (/open-queue-entries). You can reuse them by including the URLs by e.g.

      from django.urls import include, path
      urlpatterns = [
          # ...
          path("", include("parviraptor.urls")),
          # ...
      ]
    
    • /queue-monitoring: As a german IT department started implementing this functionality this endpoint serves "Alles OK" in case everything is fine. If there are failed, long unprocessed or long pending jobs, they are counted per queue and written down in english plain text.

    • /open-queue-entries serves a human-readable, styled table (in English) with open or pending job counts.

  • The management command process_queue starts a worker for processing a certain job queue. It internally manages each necessary job transition (e.g. PROCESSING -> FAILED). parviraptor supports so-called temporary job failures, i.e. if a "temporary exception" is raised, parviraptor resumes the job respecting the per-job configurable backoff strategy.

    • generic call: ./manage.py process_queue <app_label> <model>.
    • example: ./manage.py process_queue very_busy_app HeavyDutyJob
  • The management command clean_old_processed_jobs can be used for cleaning up stale job entries.

  • parviraptor.test provides a simple API for testing job queues. parviraptor.test.make_test_case_for_all_queues infers a test class which automatically covers all queues in your current codebase. You just need to derive from JobEntryFactory and provide an implementation which covers creating concrete instances for each job class. For further details, see according class and function documentations.

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

parviraptor-3.3.2a1.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

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

parviraptor-3.3.2a1-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file parviraptor-3.3.2a1.tar.gz.

File metadata

  • Download URL: parviraptor-3.3.2a1.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for parviraptor-3.3.2a1.tar.gz
Algorithm Hash digest
SHA256 f1a31000deb64577f6df0a1850e2710d43d5031b3115e71697ee35ee4c454b04
MD5 5ac4463568bb2e5bdbedfa9d06afaf04
BLAKE2b-256 26e19fd4fafeb71cfda32a99c107163779da52c35103c9d383703bb747904a08

See more details on using hashes here.

Provenance

The following attestation bundles were made for parviraptor-3.3.2a1.tar.gz:

Publisher: python-publish.yml on puzzleYOU/parviraptor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parviraptor-3.3.2a1-py3-none-any.whl.

File metadata

  • Download URL: parviraptor-3.3.2a1-py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for parviraptor-3.3.2a1-py3-none-any.whl
Algorithm Hash digest
SHA256 d876652e2fa384bbd5933c89121d86fbda7c44f283ab8c08ee1ef66a4f6ad851
MD5 48ba683da3ff1be7367f51fd5182d148
BLAKE2b-256 5689e4e120ad6dda3728fe0bc4c17172ad78a6445076e1a44b6da89eec7a4b2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for parviraptor-3.3.2a1-py3-none-any.whl:

Publisher: python-publish.yml on puzzleYOU/parviraptor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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