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.4.0.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.4.0-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file parviraptor-3.4.0.tar.gz.

File metadata

  • Download URL: parviraptor-3.4.0.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.4.0.tar.gz
Algorithm Hash digest
SHA256 592c4757e37367d40e11f5affbbed23ee8087b6f255daf137bd0a82e782dfdd2
MD5 d0613a486f9499e8e1b047a9041d7d77
BLAKE2b-256 80b6d18b7df907dcad1d7b0110078e5acb634412b84fbbc664232655eee4b80a

See more details on using hashes here.

Provenance

The following attestation bundles were made for parviraptor-3.4.0.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: parviraptor-3.4.0-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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ed0a113d2a68428130704997e313ee63d1782919de04a53a0002d45ff29ab18
MD5 fa3a3e25d9bfae040625c649ee2b5606
BLAKE2b-256 7685787fb462c28f27cb992661af246f1557247dfd76da71dbb26d26bfbb8e6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for parviraptor-3.4.0-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