simple-module-background-tasks 0.0.44__tar.gz → 0.0.46__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/PKG-INFO +5 -5
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/invalidation.py +20 -1
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/settings.py +6 -4
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/settings_env_checks.py +18 -5
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/celery_app.py +9 -1
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/tenant_celery.py +1 -1
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/package.json +2 -2
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/pyproject.toml +5 -5
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/invalidation/test_background_tasks_invalidation_redis.py +19 -0
- simple_module_background_tasks-0.0.46/tests/core/invalidation/test_background_tasks_invalidation_warmup.py +190 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/settings/test_background_tasks_config_guards.py +3 -1
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/settings/test_background_tasks_redis_url.py +73 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/logs/sink/test_background_tasks_log_sink_loop.py +15 -4
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_eager_platform.py +8 -5
- simple_module_background_tasks-0.0.44/background_tasks/celery_app.py +0 -13
- simple_module_background_tasks-0.0.44/background_tasks/config_guards.py +0 -17
- simple_module_background_tasks-0.0.44/background_tasks/outbox_transport.py +0 -15
- simple_module_background_tasks-0.0.44/background_tasks/outbox_worker.py +0 -15
- simple_module_background_tasks-0.0.44/background_tasks/runner.py +0 -13
- simple_module_background_tasks-0.0.44/background_tasks/settings.py +0 -15
- simple_module_background_tasks-0.0.44/background_tasks/sync_db.py +0 -15
- simple_module_background_tasks-0.0.44/background_tasks/task_routing.py +0 -17
- simple_module_background_tasks-0.0.44/background_tasks/tenant_context.py +0 -17
- simple_module_background_tasks-0.0.44/background_tasks/worker_settings.py +0 -15
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/.gitignore +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/LICENSE +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/README.md +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/__init__.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/contracts/__init__.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/contracts/events.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/contracts/logs.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/contracts/outbox.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/contracts/schemas.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/__init__.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/_lifecycle.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/config_guards.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/constants.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/db_settings.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/health.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/services.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/settings_celery.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/settings_logs.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/sync_db.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/core/tracking.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/executions/__init__.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/executions/after_commit.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/executions/filters.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/executions/retry_service.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/executions/service.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/executions/tenant_context.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/locales/de.json +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/locales/en.json +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/logs/__init__.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/logs/purge.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/logs/service.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/logs/sink.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/models.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/module.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/__init__.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/claim.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/clock.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/dispatch.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/guard.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/loop.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/service.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/support.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/sweep.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/transport.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/outbox/worker.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/pages/Detail.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/pages/Index.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/pages/Logs.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/pages/Outbox.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/pages/Workers.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/pages/api.generated.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/pages/api.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/py.typed +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/tasks.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/DetailFacts.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/ExecutionRow.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/ExecutionsTable.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/LogLevelSelect.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/LogTable.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/LogsPanel.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/OutboxTable.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/PayloadCards.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/ProgressCard.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/RetryAllDialog.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/RetryConfirmDialog.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/RoutesTable.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/StatusPill.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/StatusStrip.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/TaskFilters.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/TasksEmpty.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/TracebackCard.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/WorkerCard.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/WorkerEmptyStates.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/components/WorkerHealthBanner.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/utils/constants.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/utils/logs.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/utils/outbox.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/utils/retry.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/ui/utils/worker-health.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/__init__.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/deps.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/endpoints/__init__.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/endpoints/api_admin.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/endpoints/api_status.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/endpoints/logs_api.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/endpoints/logs_views.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/endpoints/outbox_api.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/endpoints/outbox_views.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/web/endpoints/views.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/__init__.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/_signal_bus.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/_signal_support.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/fleet_state.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/inspector.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/log_context.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/runner.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/settings.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/signals.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/task_heartbeat.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/task_resource.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/background_tasks/worker/task_routing.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/conftest.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/health/test_background_tasks_redis_health.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/invalidation/test_background_tasks_invalidation.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/invalidation/test_background_tasks_invalidation_degraded.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/settings/test_background_tasks_beat_schedule.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/settings/test_background_tasks_db_timeouts.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/settings/test_background_tasks_settings.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/settings/test_background_tasks_settings_env.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/settings/test_background_tasks_startup_log_masking.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/sync_db/test_background_tasks_sync_db.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/core/sync_db/test_background_tasks_sync_db_fork.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/retry/test_background_tasks_retry_failed_bulk.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/retry/test_background_tasks_retry_failed_guards.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/retry/test_background_tasks_retry_sweep_ordering.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_after_commit.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_eager_bindings.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_index_has_executions.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_list_item_payload.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_newest_first_status.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_order_index.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_publish_validation.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_read_projection.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_retention_retries.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_savepoint_publish.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_service.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/executions/service/test_background_tasks_tz_columns.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/logs/purge/test_background_tasks_log_purge.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/logs/sink/test_background_tasks_log_context.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/logs/sink/test_background_tasks_log_sink.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/logs/sink/test_background_tasks_log_sink_nul.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/admin/test_background_tasks_outbox_admin.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/admin/test_background_tasks_outbox_tenancy.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_delivery_context.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_inprocess_sweep.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_concurrency.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_delivery.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_eager_serialization.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_fence_guard.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_guard_savepoint.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_publish_scope.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_retry_policy.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_swallowed_cancel.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_worker_chain.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/delivery/test_background_tasks_outbox_worker_task.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/loop/test_background_tasks_outbox_loop_interrupt.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/outbox/loop/test_background_tasks_outbox_thread_loops.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/web/api/test_background_tasks_admin_api.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/web/api/test_background_tasks_detail_props.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/web/api/test_background_tasks_index_filters.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/web/api/test_background_tasks_log_api.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/web/api/test_background_tasks_page_clamp.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/web/api/test_background_tasks_pagination_bounds.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/web/api/test_background_tasks_task_status_api.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/web/api/test_background_tasks_users_ordering.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/inspector/test_background_tasks_index_worker_presence.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/inspector/test_background_tasks_worker_inspector.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/inspector/test_background_tasks_workers_endpoints.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/inspector/test_background_tasks_workers_uptime.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/runner/test_background_tasks_routes_override_api.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/runner/test_background_tasks_runner_settings.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/runner/test_background_tasks_task_routing.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/runner/test_background_tasks_worker_settings.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_argument_json.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_execution_bindings.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_heartbeat.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_quiet_sweep_unrecorded.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_resource_status.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_resource_transport.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_result_json.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_signal_tenant_stamp.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_signals.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_sweep_stuck.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_task_progress.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_task_progress_audit.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_tracking_modes.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_worker_audit.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/signals/test_background_tasks_worker_audit_bookkeeping.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/tenancy/test_background_tasks_custom_bases.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/tenancy/test_background_tasks_execution_tenancy.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/tenancy/test_background_tasks_tenant_context.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/tenancy/test_background_tasks_worker_tenancy.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests/worker/tenancy/test_background_tasks_worker_tenancy_context.py +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/background_tasks_DetailPage.test.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/background_tasks_IndexPage.test.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/background_tasks_LogsTab.test.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/background_tasks_OutboxPage.test.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/background_tasks_WorkerHealthBanner.test.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/background_tasks_WorkersPage.test.tsx +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/outbox.test.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/retry.test.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/stub-fetch.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tests-js/task-formatters.test.ts +0 -0
- {simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/tsconfig.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: simple_module_background_tasks
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.46
|
|
4
4
|
Summary: Celery + Redis task queue with admin UI for monitoring and retrying failed/stuck tasks
|
|
5
5
|
Project-URL: Homepage, https://github.com/antosubash/simple_module_python
|
|
6
6
|
Project-URL: Repository, https://github.com/antosubash/simple_module_python
|
|
@@ -23,10 +23,10 @@ Classifier: Typing :: Typed
|
|
|
23
23
|
Requires-Python: >=3.12
|
|
24
24
|
Requires-Dist: celery[redis]<6,>=5.4
|
|
25
25
|
Requires-Dist: redis<9,>=5
|
|
26
|
-
Requires-Dist: simple-module-core==0.0.
|
|
27
|
-
Requires-Dist: simple-module-db==0.0.
|
|
28
|
-
Requires-Dist: simple-module-hosting==0.0.
|
|
29
|
-
Requires-Dist: simple-module-settings==0.0.
|
|
26
|
+
Requires-Dist: simple-module-core==0.0.46
|
|
27
|
+
Requires-Dist: simple-module-db==0.0.46
|
|
28
|
+
Requires-Dist: simple-module-hosting==0.0.46
|
|
29
|
+
Requires-Dist: simple-module-settings==0.0.46
|
|
30
30
|
Description-Content-Type: text/markdown
|
|
31
31
|
|
|
32
32
|
# simple_module_background_tasks
|
|
@@ -83,7 +83,9 @@ answering would hang that request indefinitely rather than degrade the fan-out.
|
|
|
83
83
|
One second is far more than a local round trip needs and far less than a user
|
|
84
84
|
waits. Exceeding it raises, which the bus logs and swallows: the local eviction
|
|
85
85
|
has already happened, so the cost of the timeout is the same staleness window
|
|
86
|
-
that existed before this transport.
|
|
86
|
+
that existed before this transport. The listener opens the connection a publish
|
|
87
|
+
uses ahead of time (``_warm_publish_connection``), so the budget normally covers
|
|
88
|
+
a round trip on an open socket, not a connect.
|
|
87
89
|
"""
|
|
88
90
|
|
|
89
91
|
|
|
@@ -174,6 +176,7 @@ class RedisInvalidationTransport:
|
|
|
174
176
|
pubsub = self._client.pubsub()
|
|
175
177
|
async with asyncio.timeout(SUBSCRIBE_TIMEOUT_SECONDS):
|
|
176
178
|
await pubsub.subscribe(self._channel)
|
|
179
|
+
await self._warm_publish_connection()
|
|
177
180
|
if self._warned:
|
|
178
181
|
logger.info("Invalidation listener reconnected to %r", self._channel)
|
|
179
182
|
self._warned = False
|
|
@@ -198,6 +201,22 @@ class RedisInvalidationTransport:
|
|
|
198
201
|
with contextlib.suppress(Exception):
|
|
199
202
|
await pubsub.aclose()
|
|
200
203
|
|
|
204
|
+
async def _warm_publish_connection(self) -> None:
|
|
205
|
+
"""Open the command connection the next publish will use, off the request path.
|
|
206
|
+
|
|
207
|
+
The client opens it lazily, so without this the first publish after boot,
|
|
208
|
+
or after Redis came back, paid the TCP connect inside its 1 s budget and
|
|
209
|
+
lost the message under load (GH #880). Runs after every successful
|
|
210
|
+
SUBSCRIBE because an outage drops both connections. A failure here leaves
|
|
211
|
+
the listener up: the subscription is what keeps this worker receiving, and
|
|
212
|
+
a cold publish still connects on its own.
|
|
213
|
+
"""
|
|
214
|
+
try:
|
|
215
|
+
async with asyncio.timeout(SUBSCRIBE_TIMEOUT_SECONDS):
|
|
216
|
+
await self._client.ping()
|
|
217
|
+
except Exception as exc:
|
|
218
|
+
logger.debug("Invalidation publish connection not warmed: %s", exc)
|
|
219
|
+
|
|
201
220
|
def _log_failure(self, exc: Exception) -> None:
|
|
202
221
|
"""Warn once per outage, then stay quiet about the same outage."""
|
|
203
222
|
if self._warned:
|
|
@@ -18,10 +18,12 @@ backend on different Redis databases.
|
|
|
18
18
|
|
|
19
19
|
``SM_BG_TASKS_BROKER_URL`` and ``SM_BG_TASKS_RESULT_BACKEND`` still work and
|
|
20
20
|
take precedence over ``SM_REDIS_URL`` — a deployment that set them meant them —
|
|
21
|
-
but log a deprecation warning
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
but log a deprecation warning when they hold a Redis URL (any other transport,
|
|
22
|
+
such as ``memory://``, is theirs to set and logs nothing, GH #868). Being real
|
|
23
|
+
env reads, they also beat a stored value (env → DB → default, GH #486). They
|
|
24
|
+
are answered by pydantic's own env source now that ``env_prefix`` is set
|
|
25
|
+
(GH #283), which is also what stops every other field being readable from its
|
|
26
|
+
bare, unprefixed name.
|
|
25
27
|
|
|
26
28
|
The other env read is ``SM_ENVIRONMENT``, consulted by the
|
|
27
29
|
``@model_validator`` to refuse a localhost broker in production — that's a
|
|
@@ -15,6 +15,12 @@ from background_tasks.core.constants import ENV_PREFIX, ENV_REDIS_URL
|
|
|
15
15
|
|
|
16
16
|
logger = logging.getLogger("background_tasks.settings")
|
|
17
17
|
|
|
18
|
+
# Schemes one SM_REDIS_URL can carry everywhere it is read: Celery's broker and
|
|
19
|
+
# result backend, and redis-py's ``from_url`` behind the rate limiter, leases and
|
|
20
|
+
# the invalidation transport. Celery's ``redis+socket`` and ``sentinel`` fail
|
|
21
|
+
# there, so those values stay on the per-field vars without a warning.
|
|
22
|
+
_REDIS_SCHEMES = frozenset({"redis", "rediss"})
|
|
23
|
+
|
|
18
24
|
|
|
19
25
|
def warn_on_legacy_redis_vars(broker_url: str, result_backend: str) -> None:
|
|
20
26
|
"""Nudge deployments off the per-field names onto ``SM_REDIS_URL``.
|
|
@@ -25,12 +31,19 @@ def warn_on_legacy_redis_vars(broker_url: str, result_backend: str) -> None:
|
|
|
25
31
|
than in the default factory because ``env_prefix`` means the env source
|
|
26
32
|
answers these names before any default is consulted, so the factory never
|
|
27
33
|
sees them.
|
|
34
|
+
|
|
35
|
+
Only a Redis URL is warned about (#868): for anything else, such as the
|
|
36
|
+
in-process ``memory://`` + ``cache+memory://`` pair or an AMQP broker,
|
|
37
|
+
``SM_REDIS_URL`` can't express the value and these vars are the way to
|
|
38
|
+
set it.
|
|
28
39
|
"""
|
|
29
40
|
for value, legacy_var in (
|
|
30
41
|
(broker_url, f"{ENV_PREFIX}BROKER_URL"),
|
|
31
42
|
(result_backend, f"{ENV_PREFIX}RESULT_BACKEND"),
|
|
32
43
|
):
|
|
33
|
-
if os.environ.get(legacy_var)
|
|
44
|
+
if os.environ.get(legacy_var) != value:
|
|
45
|
+
continue
|
|
46
|
+
if value.partition("://")[0].lower() in _REDIS_SCHEMES:
|
|
34
47
|
logger.warning(
|
|
35
48
|
"%s is deprecated; use %s instead (one URL seeds both the "
|
|
36
49
|
"broker and the result backend).",
|
|
@@ -61,8 +74,8 @@ def forbid_localhost_broker_in_production(broker_url: str, result_backend: str)
|
|
|
61
74
|
f"{names} must not point at localhost when SM_ENVIRONMENT={env!r}. "
|
|
62
75
|
f"Set {ENV_REDIS_URL} on the container to the Redis service host "
|
|
63
76
|
"(e.g. redis://redis:6379/0) — one URL seeds both the broker and "
|
|
64
|
-
f"the result backend. ({env_names} still override it per field
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"this at boot."
|
|
77
|
+
f"the result backend. ({env_names} still override it per field; "
|
|
78
|
+
"they are deprecated for a Redis URL, but stay the way to set any "
|
|
79
|
+
"other transport.) Environment variables are read before the "
|
|
80
|
+
"DB-backed settings exist, so one is what satisfies this at boot."
|
|
68
81
|
)
|
|
@@ -17,6 +17,7 @@ from __future__ import annotations
|
|
|
17
17
|
|
|
18
18
|
import importlib
|
|
19
19
|
import logging
|
|
20
|
+
from functools import cache
|
|
20
21
|
from importlib.metadata import entry_points
|
|
21
22
|
|
|
22
23
|
from celery import Celery
|
|
@@ -47,12 +48,19 @@ def _discover_task_packages() -> list[str]:
|
|
|
47
48
|
returned here, so any module that ships a ``tasks.py`` registers its
|
|
48
49
|
tasks without a per-module hook.
|
|
49
50
|
"""
|
|
51
|
+
return list(_installed_packages())
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@cache
|
|
55
|
+
def _installed_packages() -> tuple[str, ...]:
|
|
56
|
+
# Scanning entry points reads every installed distribution's metadata, and
|
|
57
|
+
# the installed set cannot change while the process runs.
|
|
50
58
|
packages: set[str] = set()
|
|
51
59
|
for ep in entry_points(group=ENTRY_POINT_GROUP):
|
|
52
60
|
module_path = ep.value.split(":", 1)[0]
|
|
53
61
|
top_level = module_path.split(".", 1)[0]
|
|
54
62
|
packages.add(top_level)
|
|
55
|
-
return sorted(packages)
|
|
63
|
+
return tuple(sorted(packages))
|
|
56
64
|
|
|
57
65
|
|
|
58
66
|
def _collect_module_beat_schedules(packages: list[str]) -> dict:
|
|
@@ -52,7 +52,7 @@ class TenantCelery(Celery):
|
|
|
52
52
|
kwargs.setdefault("task_cls", TenantTask)
|
|
53
53
|
super().__init__(*args, **kwargs)
|
|
54
54
|
|
|
55
|
-
def _task_from_fun( # ty: ignore[
|
|
55
|
+
def _task_from_fun( # ty: ignore[incompatible-method-override]
|
|
56
56
|
self,
|
|
57
57
|
fun: Any,
|
|
58
58
|
name: Any = None,
|
{simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/package.json
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-module-py/background-tasks",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Frontend assets for the BackgroundTasks module",
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@inertiajs/react": "^3.
|
|
7
|
+
"@inertiajs/react": "^3.11.0",
|
|
8
8
|
"@simple-module-py/ui": "*",
|
|
9
9
|
"react": "^19.0.0",
|
|
10
10
|
"react-dom": "^19.3.1"
|
{simple_module_background_tasks-0.0.44 → simple_module_background_tasks-0.0.46}/pyproject.toml
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "simple_module_background_tasks"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.46"
|
|
4
4
|
description = "Celery + Redis task queue with admin UI for monitoring and retrying failed/stuck tasks"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -21,10 +21,10 @@ classifiers = [
|
|
|
21
21
|
"Typing :: Typed",
|
|
22
22
|
]
|
|
23
23
|
dependencies = [
|
|
24
|
-
"simple_module_core==0.0.
|
|
25
|
-
"simple_module_db==0.0.
|
|
26
|
-
"simple_module_hosting==0.0.
|
|
27
|
-
"simple_module_settings==0.0.
|
|
24
|
+
"simple_module_core==0.0.46",
|
|
25
|
+
"simple_module_db==0.0.46",
|
|
26
|
+
"simple_module_hosting==0.0.46",
|
|
27
|
+
"simple_module_settings==0.0.46",
|
|
28
28
|
"celery[redis]>=5.4,<6",
|
|
29
29
|
"redis>=5,<9",
|
|
30
30
|
]
|
|
@@ -20,6 +20,7 @@ import asyncio
|
|
|
20
20
|
import os
|
|
21
21
|
|
|
22
22
|
import pytest
|
|
23
|
+
from background_tasks.core import invalidation as bg_invalidation
|
|
23
24
|
from background_tasks.core.invalidation import RedisInvalidationTransport
|
|
24
25
|
from simple_module_core.invalidation import Invalidation, InvalidationBus
|
|
25
26
|
from simple_module_test import wait_for
|
|
@@ -32,6 +33,24 @@ _CHANNEL = f"qa.invalidation.{os.getpid()}"
|
|
|
32
33
|
_DELIVERY_TIMEOUT_SECONDS = 5.0
|
|
33
34
|
|
|
34
35
|
|
|
36
|
+
@pytest.fixture(autouse=True)
|
|
37
|
+
def _patient_publish(monkeypatch):
|
|
38
|
+
"""Give a publish the delivery wait's budget instead of production's 1 s.
|
|
39
|
+
|
|
40
|
+
``PUBLISH_TIMEOUT_SECONDS`` bounds the whole publish, and a publisher's first
|
|
41
|
+
publish may open its command connection. The listener warms it after SUBSCRIBE
|
|
42
|
+
(GH #880), but these tests publish right after ``start()``, before that can
|
|
43
|
+
finish. In CI that connect was cancelled by the 1 s timeout inside
|
|
44
|
+
``create_connection``, the bus logged "Invalidation broadcast failed", and the
|
|
45
|
+
message was lost (GH #865). ``start()`` also reads it as
|
|
46
|
+
``socket_connect_timeout``, so this fixture must run before a transport starts,
|
|
47
|
+
and a test here that needs the production bound has to set it back. These tests
|
|
48
|
+
prove redis-py's wire behaviour; the timeout itself is covered against a mute
|
|
49
|
+
broker in ``test_background_tasks_invalidation_degraded.py``.
|
|
50
|
+
"""
|
|
51
|
+
monkeypatch.setattr(bg_invalidation, "PUBLISH_TIMEOUT_SECONDS", _DELIVERY_TIMEOUT_SECONDS)
|
|
52
|
+
|
|
53
|
+
|
|
35
54
|
async def _await_delivery(seen: list[Invalidation], count: int = 1) -> None:
|
|
36
55
|
"""Wait for the listener task to have delivered *count* messages.
|
|
37
56
|
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"""The listener warms the connection a publish will use (GH #880).
|
|
2
|
+
|
|
3
|
+
``publish`` runs under a 1 s budget in the request's response cycle, and the
|
|
4
|
+
client's command connection opens lazily. Without a warm-up the first publish
|
|
5
|
+
after boot, or after an outage, paid the TCP connect inside that second and lost
|
|
6
|
+
the message under load. The listener PINGs the command client after every
|
|
7
|
+
successful SUBSCRIBE, off the request path, so that connection is already open.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import asyncio
|
|
13
|
+
import os
|
|
14
|
+
import uuid
|
|
15
|
+
|
|
16
|
+
import pytest
|
|
17
|
+
from background_tasks.core import invalidation as bg_invalidation
|
|
18
|
+
from background_tasks.core.invalidation import RedisInvalidationTransport
|
|
19
|
+
from simple_module_core.invalidation import Invalidation, InvalidationBus
|
|
20
|
+
from simple_module_test import wait_for
|
|
21
|
+
|
|
22
|
+
_CHANNEL = "sm.invalidation.warmup"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class _PubSub:
|
|
26
|
+
def __init__(self, frames, subscribe_error) -> None:
|
|
27
|
+
self._frames = list(frames)
|
|
28
|
+
self._subscribe_error = subscribe_error
|
|
29
|
+
self.subscribed = False
|
|
30
|
+
|
|
31
|
+
async def subscribe(self, channel: str) -> None:
|
|
32
|
+
if self._subscribe_error is not None:
|
|
33
|
+
raise self._subscribe_error
|
|
34
|
+
self.subscribed = True
|
|
35
|
+
|
|
36
|
+
async def get_message(self, ignore_subscribe_messages: bool = False, timeout=None):
|
|
37
|
+
if self._frames:
|
|
38
|
+
return self._frames.pop(0)
|
|
39
|
+
await asyncio.sleep(timeout or 0) # intentional-sleep: fake idle-channel poll interval
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
async def aclose(self) -> None: ...
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class _Redis:
|
|
46
|
+
"""Records PINGs; the first ``fail_subscribes`` subscriptions raise."""
|
|
47
|
+
|
|
48
|
+
def __init__(self, frames=(), fail_subscribes=0, ping_error=None, ping_hangs=False) -> None:
|
|
49
|
+
self.pings = 0
|
|
50
|
+
self.pubsubs: list[_PubSub] = []
|
|
51
|
+
self._frames = frames
|
|
52
|
+
self._fail_subscribes = fail_subscribes
|
|
53
|
+
self._ping_error = ping_error
|
|
54
|
+
self._ping_hangs = ping_hangs
|
|
55
|
+
|
|
56
|
+
def pubsub(self) -> _PubSub:
|
|
57
|
+
error = None
|
|
58
|
+
if self._fail_subscribes:
|
|
59
|
+
self._fail_subscribes -= 1
|
|
60
|
+
error = ConnectionError("redis down")
|
|
61
|
+
ps = _PubSub(self._frames, error)
|
|
62
|
+
self.pubsubs.append(ps)
|
|
63
|
+
return ps
|
|
64
|
+
|
|
65
|
+
async def ping(self) -> bool:
|
|
66
|
+
self.pings += 1
|
|
67
|
+
if self._ping_hangs:
|
|
68
|
+
await asyncio.Event().wait()
|
|
69
|
+
if self._ping_error is not None:
|
|
70
|
+
raise self._ping_error
|
|
71
|
+
return True
|
|
72
|
+
|
|
73
|
+
async def aclose(self) -> None: ...
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@pytest.fixture
|
|
77
|
+
def fake_redis(monkeypatch):
|
|
78
|
+
import redis.asyncio as aioredis
|
|
79
|
+
|
|
80
|
+
def install(**kwargs) -> _Redis:
|
|
81
|
+
fake = _Redis(**kwargs)
|
|
82
|
+
monkeypatch.setattr(aioredis, "from_url", lambda *a, **kw: fake)
|
|
83
|
+
return fake
|
|
84
|
+
|
|
85
|
+
monkeypatch.setattr(bg_invalidation, "INITIAL_BACKOFF_SECONDS", 0.01)
|
|
86
|
+
monkeypatch.setattr(bg_invalidation, "LISTEN_POLL_SECONDS", 0.01)
|
|
87
|
+
return install
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _frame(key: str) -> dict:
|
|
91
|
+
wire = Invalidation(channel=_CHANNEL, key=key, origin="elsewhere").to_wire()
|
|
92
|
+
return {"type": "message", "data": wire.encode()}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class TestWarmUp:
|
|
96
|
+
async def test_the_listener_pings_once_it_has_subscribed(self, fake_redis):
|
|
97
|
+
fake = fake_redis()
|
|
98
|
+
transport = RedisInvalidationTransport(InvalidationBus(), "redis://fake", _CHANNEL)
|
|
99
|
+
await transport.start()
|
|
100
|
+
try:
|
|
101
|
+
await wait_for(lambda: fake.pings == 1)
|
|
102
|
+
assert fake.pubsubs[0].subscribed
|
|
103
|
+
finally:
|
|
104
|
+
await transport.stop()
|
|
105
|
+
|
|
106
|
+
async def test_a_reconnect_warms_again(self, fake_redis):
|
|
107
|
+
"""A Redis restart drops both connections; the resubscribe re-warms."""
|
|
108
|
+
fake = fake_redis(fail_subscribes=1)
|
|
109
|
+
transport = RedisInvalidationTransport(InvalidationBus(), "redis://fake", _CHANNEL)
|
|
110
|
+
await transport.start()
|
|
111
|
+
try:
|
|
112
|
+
await wait_for(lambda: fake.pings == 1)
|
|
113
|
+
assert [ps.subscribed for ps in fake.pubsubs] == [False, True]
|
|
114
|
+
finally:
|
|
115
|
+
await transport.stop()
|
|
116
|
+
|
|
117
|
+
async def test_no_ping_before_a_subscribe_succeeds(self, fake_redis):
|
|
118
|
+
fake = fake_redis(fail_subscribes=10**6)
|
|
119
|
+
transport = RedisInvalidationTransport(InvalidationBus(), "redis://fake", _CHANNEL)
|
|
120
|
+
await transport.start()
|
|
121
|
+
try:
|
|
122
|
+
await wait_for(lambda: len(fake.pubsubs) >= 3)
|
|
123
|
+
assert fake.pings == 0
|
|
124
|
+
finally:
|
|
125
|
+
await transport.stop()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class TestAFailedWarmUpIsHarmless:
|
|
129
|
+
@pytest.mark.parametrize("ping", ["raises", "hangs"])
|
|
130
|
+
async def test_the_listener_still_delivers(self, fake_redis, monkeypatch, ping):
|
|
131
|
+
monkeypatch.setattr(bg_invalidation, "SUBSCRIBE_TIMEOUT_SECONDS", 0.05)
|
|
132
|
+
if ping == "raises":
|
|
133
|
+
fake = fake_redis(frames=[_frame("k")], ping_error=ConnectionError("no"))
|
|
134
|
+
else:
|
|
135
|
+
fake = fake_redis(frames=[_frame("k")], ping_hangs=True)
|
|
136
|
+
bus = InvalidationBus()
|
|
137
|
+
seen: list[Invalidation] = []
|
|
138
|
+
bus.subscribe(_CHANNEL, seen.append)
|
|
139
|
+
transport = RedisInvalidationTransport(bus, "redis://fake", _CHANNEL)
|
|
140
|
+
await transport.start()
|
|
141
|
+
try:
|
|
142
|
+
await wait_for(lambda: bool(seen))
|
|
143
|
+
finally:
|
|
144
|
+
await transport.stop()
|
|
145
|
+
|
|
146
|
+
assert [i.key for i in seen] == ["k"]
|
|
147
|
+
assert len(fake.pubsubs) == 1, "a failed warm-up must not restart the listener"
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class TestAgainstARealServer:
|
|
151
|
+
async def test_a_publish_reuses_the_warmed_connection(self, redis_server):
|
|
152
|
+
"""The server sees the PING'd connection, and the publish arrives on it.
|
|
153
|
+
|
|
154
|
+
Clients are found by a per-test ``client_name`` (parsed from the URL by
|
|
155
|
+
redis-py): under xdist every worker shares one Redis, so counting all of
|
|
156
|
+
the server's clients would race the other workers.
|
|
157
|
+
"""
|
|
158
|
+
import redis.asyncio as aioredis
|
|
159
|
+
|
|
160
|
+
name = f"sm-warmup-{os.getpid()}-{uuid.uuid4().hex[:8]}"
|
|
161
|
+
sep = "&" if "?" in redis_server else "?"
|
|
162
|
+
transport = RedisInvalidationTransport(
|
|
163
|
+
InvalidationBus(), f"{redis_server}{sep}client_name={name}", _CHANNEL
|
|
164
|
+
)
|
|
165
|
+
probe = aioredis.from_url(redis_server)
|
|
166
|
+
|
|
167
|
+
async def ours() -> list[dict]:
|
|
168
|
+
return [c for c in await probe.client_list() if c.get("name") == name]
|
|
169
|
+
|
|
170
|
+
async def warmed() -> list[dict]:
|
|
171
|
+
clients = await ours()
|
|
172
|
+
return clients if any(c["cmd"] == "ping" for c in clients) else []
|
|
173
|
+
|
|
174
|
+
await transport.start()
|
|
175
|
+
try:
|
|
176
|
+
before = await wait_for(warmed, timeout=5.0)
|
|
177
|
+
await transport.publish(
|
|
178
|
+
Invalidation(channel=_CHANNEL, key="k", origin="elsewhere").to_wire()
|
|
179
|
+
)
|
|
180
|
+
after = await ours()
|
|
181
|
+
finally:
|
|
182
|
+
await transport.stop()
|
|
183
|
+
await probe.aclose()
|
|
184
|
+
|
|
185
|
+
assert len(before) == 2, "expected the subscription plus one warmed command connection"
|
|
186
|
+
warmed_id = next(c["id"] for c in before if c["cmd"] == "ping")
|
|
187
|
+
assert {c["id"] for c in after} == {c["id"] for c in before}, (
|
|
188
|
+
"publish opened a new connection"
|
|
189
|
+
)
|
|
190
|
+
assert next(c["cmd"] for c in after if c["id"] == warmed_id) == "publish"
|
|
@@ -64,7 +64,9 @@ def test_env_overrides_bad_json_or_shape_is_ignored(monkeypatch, caplog) -> None
|
|
|
64
64
|
def test_celery_overrides_is_not_a_db_backed_setting(monkeypatch) -> None:
|
|
65
65
|
assert "celery_overrides" not in BackgroundTasksSettings.model_fields
|
|
66
66
|
# A stored/hydrated value is ignored, not applied.
|
|
67
|
-
s = BackgroundTasksSettings(
|
|
67
|
+
s = BackgroundTasksSettings( # ty: ignore[pydantic-discarded-extra-argument]
|
|
68
|
+
celery_overrides={"task_serializer": "pickle"}
|
|
69
|
+
)
|
|
68
70
|
assert not hasattr(s, "celery_overrides")
|
|
69
71
|
monkeypatch.setattr(celery_app, "_discover_task_packages", list)
|
|
70
72
|
c = celery_app.build_celery(BackgroundTasksSettings(task_always_eager=True))
|
|
@@ -145,3 +145,76 @@ def test_legacy_var_still_beats_redis_url_and_the_db(monkeypatch: pytest.MonkeyP
|
|
|
145
145
|
|
|
146
146
|
assert settings.broker_url == "redis://legacy:6379/0"
|
|
147
147
|
assert settings.result_backend == "redis://cache:6379/2"
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def test_in_process_transports_boot_production_without_a_warning(
|
|
151
|
+
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
|
|
152
|
+
) -> None:
|
|
153
|
+
"""#868: a production host with no Redis runs tasks in-process. No single
|
|
154
|
+
SM_REDIS_URL can name both halves, so the per-field vars are the only way
|
|
155
|
+
to say it and must not be called deprecated."""
|
|
156
|
+
monkeypatch.setenv("SM_ENVIRONMENT", "production")
|
|
157
|
+
monkeypatch.setenv("SM_BG_TASKS_BROKER_URL", "memory://")
|
|
158
|
+
monkeypatch.setenv("SM_BG_TASKS_RESULT_BACKEND", "cache+memory://")
|
|
159
|
+
|
|
160
|
+
with caplog.at_level(logging.WARNING):
|
|
161
|
+
settings = BackgroundTasksSettings()
|
|
162
|
+
|
|
163
|
+
assert settings.broker_url == "memory://"
|
|
164
|
+
assert settings.result_backend == "cache+memory://"
|
|
165
|
+
assert "deprecated" not in caplog.text.lower()
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def test_non_redis_broker_logs_no_warning(
|
|
169
|
+
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
|
|
170
|
+
) -> None:
|
|
171
|
+
monkeypatch.setenv("SM_BG_TASKS_BROKER_URL", "amqp://guest@rabbit:5672//")
|
|
172
|
+
|
|
173
|
+
with caplog.at_level(logging.WARNING):
|
|
174
|
+
BackgroundTasksSettings()
|
|
175
|
+
|
|
176
|
+
assert "deprecated" not in caplog.text.lower()
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
@pytest.mark.parametrize(
|
|
180
|
+
"url",
|
|
181
|
+
[
|
|
182
|
+
"rediss://cache:6380/0",
|
|
183
|
+
"REDIS://cache:6379/0",
|
|
184
|
+
],
|
|
185
|
+
)
|
|
186
|
+
def test_redis_schemes_still_warn(
|
|
187
|
+
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture, url: str
|
|
188
|
+
) -> None:
|
|
189
|
+
monkeypatch.setenv("SM_BG_TASKS_BROKER_URL", url)
|
|
190
|
+
|
|
191
|
+
with caplog.at_level(logging.WARNING):
|
|
192
|
+
BackgroundTasksSettings()
|
|
193
|
+
|
|
194
|
+
assert "SM_BG_TASKS_BROKER_URL is deprecated" in caplog.text
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
@pytest.mark.parametrize("url", ["sentinel://sentinel:26379/0", "redis+socket:///run/redis.sock"])
|
|
198
|
+
def test_schemes_redis_url_cannot_carry_log_no_warning(
|
|
199
|
+
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture, url: str
|
|
200
|
+
) -> None:
|
|
201
|
+
monkeypatch.setenv("SM_BG_TASKS_BROKER_URL", url)
|
|
202
|
+
|
|
203
|
+
with caplog.at_level(logging.WARNING):
|
|
204
|
+
BackgroundTasksSettings()
|
|
205
|
+
|
|
206
|
+
assert "deprecated" not in caplog.text.lower()
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def test_warning_is_per_variable(
|
|
210
|
+
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
|
|
211
|
+
) -> None:
|
|
212
|
+
"""A Redis broker can move to SM_REDIS_URL even when the backend can't."""
|
|
213
|
+
monkeypatch.setenv("SM_BG_TASKS_BROKER_URL", "redis://old:6379/4")
|
|
214
|
+
monkeypatch.setenv("SM_BG_TASKS_RESULT_BACKEND", "rpc://")
|
|
215
|
+
|
|
216
|
+
with caplog.at_level(logging.WARNING):
|
|
217
|
+
BackgroundTasksSettings()
|
|
218
|
+
|
|
219
|
+
assert "SM_BG_TASKS_BROKER_URL is deprecated" in caplog.text
|
|
220
|
+
assert "SM_BG_TASKS_RESULT_BACKEND" not in caplog.text
|
|
@@ -33,9 +33,19 @@ def _root_at_debug() -> Iterator[None]:
|
|
|
33
33
|
db_logger.setLevel(db_before)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def _count() -> int:
|
|
36
|
+
def _count(logger: str | None = None) -> int:
|
|
37
|
+
stmt = select(func.count()).select_from(RetainedLog)
|
|
38
|
+
if logger is not None:
|
|
39
|
+
stmt = stmt.where(RetainedLog.logger == logger)
|
|
37
40
|
with sync_db.get_sync_session_factory()() as session:
|
|
38
|
-
return session.execute(
|
|
41
|
+
return session.execute(stmt).scalar_one()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _wait_for_app_lines(expected: int, timeout: float = 15.0) -> None:
|
|
45
|
+
deadline = time.monotonic() + timeout
|
|
46
|
+
while _count(APP_LOGGER.name) < expected:
|
|
47
|
+
assert time.monotonic() < deadline, "the sink never stored the app lines"
|
|
48
|
+
time.sleep(0.05) # intentional-sleep: polls the writer thread's flush
|
|
39
49
|
|
|
40
50
|
|
|
41
51
|
def test_sink_writes_are_not_retained_again():
|
|
@@ -43,9 +53,10 @@ def test_sink_writes_are_not_retained_again():
|
|
|
43
53
|
assert handler is not None
|
|
44
54
|
for i in range(5):
|
|
45
55
|
APP_LOGGER.info("line %d", i)
|
|
46
|
-
|
|
56
|
+
# The writer flushes on its own clock; a slow runner needs more than one interval.
|
|
57
|
+
_wait_for_app_lines(5)
|
|
47
58
|
first = _count()
|
|
48
|
-
time.sleep(1.5) # intentional-sleep:
|
|
59
|
+
time.sleep(1.5) # intentional-sleep: absence of feedback growth can only be observed over time
|
|
49
60
|
assert _count() == first
|
|
50
61
|
log_sink.uninstall_log_sink()
|
|
51
62
|
with sync_db.get_sync_session_factory()() as session:
|
|
@@ -22,7 +22,6 @@ from simple_module_core.events import Event
|
|
|
22
22
|
from simple_module_db import all_tenants, current_tenant_id, finalize_session, tenant_context
|
|
23
23
|
from simple_module_db.tenancy import is_all_tenants
|
|
24
24
|
from simple_module_db.transaction import SESSION_START_KEY
|
|
25
|
-
from simple_module_test import wait_for
|
|
26
25
|
|
|
27
26
|
pytestmark = pytest.mark.usefixtures("_stub_celery")
|
|
28
27
|
|
|
@@ -45,11 +44,15 @@ async def test_eager_publish_from_a_plain_session_is_delivered(app, outbox_rows)
|
|
|
45
44
|
await app.state.sm.event_bus.publish_durable(EagerPing(7), session)
|
|
46
45
|
await session.commit()
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
# Wait on the delivery task itself, not by polling the table: the test
|
|
48
|
+
# database is one in-memory SQLite connection (StaticPool), so a polling
|
|
49
|
+
# session ran on the same connection as the delivery's own transaction.
|
|
50
|
+
# That poll timed out once in CI with no delivery error logged (GH #865).
|
|
51
|
+
async with asyncio.timeout(15.0):
|
|
52
|
+
await app.state.sm.event_bus.durable_transport.drain()
|
|
51
53
|
|
|
52
|
-
await
|
|
54
|
+
rows = await outbox_rows()
|
|
55
|
+
assert rows and all(r.status == OutboxStatus.DELIVERED for r in rows)
|
|
53
56
|
assert seen == [7]
|
|
54
57
|
app.state.background_tasks.celery.send_task.assert_not_called()
|
|
55
58
|
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"""Moved to :mod:`background_tasks.worker.celery_app`; this alias goes in 0.0.46 (module layout)."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import importlib
|
|
6
|
-
import sys
|
|
7
|
-
|
|
8
|
-
from simple_module_core.deprecation import deprecated_module
|
|
9
|
-
|
|
10
|
-
deprecated_module(
|
|
11
|
-
"background_tasks.celery_app", remove_in="0.0.46", use="background_tasks.worker.celery_app"
|
|
12
|
-
)
|
|
13
|
-
sys.modules[__name__] = importlib.import_module("background_tasks.worker.celery_app")
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"""Moved to :mod:`background_tasks.core.config_guards`;
|
|
2
|
-
this alias goes in 0.0.46 (module layout).
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
import importlib
|
|
8
|
-
import sys
|
|
9
|
-
|
|
10
|
-
from simple_module_core.deprecation import deprecated_module
|
|
11
|
-
|
|
12
|
-
deprecated_module(
|
|
13
|
-
"background_tasks.config_guards",
|
|
14
|
-
remove_in="0.0.46",
|
|
15
|
-
use="background_tasks.core.config_guards",
|
|
16
|
-
)
|
|
17
|
-
sys.modules[__name__] = importlib.import_module("background_tasks.core.config_guards")
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"""Moved to :mod:`background_tasks.outbox.transport`; this alias goes in 0.0.46 (module layout)."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import importlib
|
|
6
|
-
import sys
|
|
7
|
-
|
|
8
|
-
from simple_module_core.deprecation import deprecated_module
|
|
9
|
-
|
|
10
|
-
deprecated_module(
|
|
11
|
-
"background_tasks.outbox_transport",
|
|
12
|
-
remove_in="0.0.46",
|
|
13
|
-
use="background_tasks.outbox.transport",
|
|
14
|
-
)
|
|
15
|
-
sys.modules[__name__] = importlib.import_module("background_tasks.outbox.transport")
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"""Moved to :mod:`background_tasks.outbox.worker`; this alias goes in 0.0.46 (module layout)."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import importlib
|
|
6
|
-
import sys
|
|
7
|
-
|
|
8
|
-
from simple_module_core.deprecation import deprecated_module
|
|
9
|
-
|
|
10
|
-
deprecated_module(
|
|
11
|
-
"background_tasks.outbox_worker",
|
|
12
|
-
remove_in="0.0.46",
|
|
13
|
-
use="background_tasks.outbox.worker",
|
|
14
|
-
)
|
|
15
|
-
sys.modules[__name__] = importlib.import_module("background_tasks.outbox.worker")
|