Skip to content

django-ox 1.10.0

Latest

Choose a tag to compare

@PhiLily PhiLily released this 24 Nov 07:32
57bd374

django-ox 1.10.0

The optional oxpull app now has concurrency limits. OPTIONS["CONCURRENCY_LIMITS"] on an oxpull.backend.OxpullBackend alias sets named limits on how many covered tasks are RUNNING at once, by task path or queue. A blocked task stays READY and spends no attempt. The bound is max + W - 1 across W claimers and exact with one, and max: 0 pauses the covered tasks. The option, its checks and its events are provisional. See the feature page.

django_ox.maintenance.prune is a task that runs ox_prune --format json and returns its counts. Schedule retention from OPTIONS["SCHEDULES"] instead of an external timer. Its keywords older_than, include_failed, queue, dry_run and batch_size map to the flags of the same name, with the same defaults. The task path, its keyword names and defaults, and its return value are stable.

ox_health --task-paths fails when a READY or WAITING row's task_path no longer imports to a django.tasks Task, the rule a worker applies before running it. Run it after migrate and before rolling workers. Each failing path is reported with its row count and exception class, in problems and in unknown_task_paths. That field is new in every database-mode --format json object and is null unless --task-paths ran.

ox_retry and ox_discard are new management commands for scriptable recovery of tasks. Both take one or more task UUIDs and support --queue, --dry-run and --format json. The commands are provisional.

django_ox.testing.assert_task_count() is a read-only assertion that reads the OxTask table directly. It matches by backend alias, queue and task path, and compares args and kwargs with the stored JSON values. The helper is public and provisional.

examples/keda/ is a runnable example that scales ox_worker pods from zero on django_ox_ready_tasks with KEDA. python examples/keda/check.py builds a throwaway kind cluster and proves it end to end. The new KEDA autoscaling page covers the queries, the worker settings and the recorded run.

A settings schedule entry whose task module raises InvalidTask on import is now reported as django_ox.E002, as an ImportError is, and a SCHEDULABLE_TASKS entry in the same state as django_ox.E007.

A reconciler task of the optional oxpull app now builds when QUEUES is a set that omits default, on the first queue name in sorted order.

Known issue. When ox_worker --database names an alias for a database the router does not send django-ox's writes to, the worker enqueues every due settings schedule again on each dispatch pass. A pass runs about once a second by default, so the scheduled task body runs repeatedly. That is unchanged from 1.9.1. Run such a worker under settings that give its backend no SCHEDULES, and keep stored schedules off its database. Or have the router, in that worker's process, send django-ox's writes to the worker's alias. Read replicas describes the behaviour and the remedy.

Thanks to @devpryan7792 (#147 and #149) and @bernalalexis-try (#148) for their contributions to this release.

No database migration is required. See the changelog for details.