simple-module-background-tasks 0.0.47__tar.gz → 0.0.48__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.47 → simple_module_background_tasks-0.0.48}/.gitignore +6 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/PKG-INFO +5 -5
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/contracts/outbox.py +0 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/_lifecycle.py +28 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/constants.py +21 -10
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/invalidation.py +8 -4
- simple_module_background_tasks-0.0.48/background_tasks/core/invalidation_channel.py +18 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/settings_celery.py +3 -10
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/settings_env_checks.py +1 -1
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/sync_db.py +1 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/locales/de.json +2 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/locales/en.json +2 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/module.py +3 -18
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/service.py +2 -1
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/worker.py +14 -15
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/pages/Detail.tsx +2 -5
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/pages/Workers.tsx +1 -1
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/pages/api.generated.ts +4 -7
- simple_module_background_tasks-0.0.48/background_tasks/pages/i18n.generated.ts +436 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/WorkerHealthBanner.tsx +1 -1
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/utils/logs.ts +1 -1
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/utils/outbox.ts +1 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/utils/retry.ts +1 -1
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/endpoints/api_admin.py +4 -5
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/endpoints/api_status.py +3 -3
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/endpoints/logs_api.py +2 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/endpoints/logs_views.py +2 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/endpoints/outbox_api.py +4 -5
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/endpoints/outbox_views.py +2 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/endpoints/views.py +2 -9
- simple_module_background_tasks-0.0.48/background_tasks/worker/principals.py +43 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/runner.py +8 -0
- simple_module_background_tasks-0.0.48/package.json +9 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/pyproject.toml +5 -5
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/invalidation/test_background_tasks_invalidation.py +7 -3
- simple_module_background_tasks-0.0.48/tests/core/invalidation/test_installation_channel.py +96 -0
- simple_module_background_tasks-0.0.48/tests/core/invalidation/test_invalidation_bridge.py +92 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/settings/test_background_tasks_redis_url.py +8 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/settings/test_background_tasks_settings.py +2 -13
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/settings/test_background_tasks_settings_env.py +0 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/admin/test_background_tasks_outbox_admin.py +45 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/admin/test_background_tasks_outbox_tenancy.py +2 -5
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_worker_chain.py +1 -1
- simple_module_background_tasks-0.0.48/tests/web/api/test_background_tasks_detail_props.py +49 -0
- simple_module_background_tasks-0.0.48/tests/worker/runner/test_background_tasks_database_provider.py +18 -0
- simple_module_background_tasks-0.0.48/tests/worker/runner/test_background_tasks_principal_config.py +60 -0
- simple_module_background_tasks-0.0.48/tests/worker/runner/test_background_tasks_principals.py +77 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/runner/test_background_tasks_runner_settings.py +20 -2
- simple_module_background_tasks-0.0.48/tests/worker/runner/test_runner_invalidation_identity.py +36 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_quiet_sweep_unrecorded.py +2 -1
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/background_tasks_DetailPage.test.tsx +16 -2
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/background_tasks_OutboxPage.test.tsx +0 -1
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/background_tasks_WorkersPage.test.tsx +2 -2
- simple_module_background_tasks-0.0.47/background_tasks/pages/api.ts +0 -9
- simple_module_background_tasks-0.0.47/package.json +0 -20
- simple_module_background_tasks-0.0.47/tests/web/api/test_background_tasks_detail_props.py +0 -78
- simple_module_background_tasks-0.0.47/tsconfig.json +0 -15
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/LICENSE +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/README.md +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/__init__.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/contracts/__init__.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/contracts/events.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/contracts/logs.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/contracts/schemas.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/__init__.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/config_guards.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/db_settings.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/health.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/services.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/settings.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/settings_logs.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/core/tracking.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/executions/__init__.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/executions/after_commit.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/executions/filters.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/executions/retry_service.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/executions/service.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/executions/tenant_context.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/logs/__init__.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/logs/purge.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/logs/service.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/logs/sink.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/models.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/__init__.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/claim.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/clock.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/dispatch.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/guard.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/loop.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/support.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/sweep.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/outbox/transport.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/pages/Index.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/pages/Logs.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/pages/Outbox.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/py.typed +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/tasks.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/DetailFacts.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/ExecutionRow.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/ExecutionsTable.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/LogLevelSelect.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/LogTable.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/LogsPanel.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/OutboxTable.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/PayloadCards.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/ProgressCard.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/RetryAllDialog.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/RetryConfirmDialog.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/RoutesTable.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/StatusPill.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/StatusStrip.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/TaskFilters.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/TasksEmpty.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/TracebackCard.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/WorkerCard.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/components/WorkerEmptyStates.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/utils/constants.ts +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/ui/utils/worker-health.ts +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/__init__.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/deps.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/web/endpoints/__init__.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/__init__.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/_signal_bus.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/_signal_support.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/celery_app.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/fleet_state.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/inspector.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/log_context.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/settings.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/signals.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/task_heartbeat.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/task_resource.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/task_routing.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/background_tasks/worker/tenant_celery.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/conftest.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/health/test_background_tasks_redis_health.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/invalidation/test_background_tasks_invalidation_degraded.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/invalidation/test_background_tasks_invalidation_redis.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/invalidation/test_background_tasks_invalidation_warmup.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/settings/test_background_tasks_beat_schedule.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/settings/test_background_tasks_config_guards.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/settings/test_background_tasks_db_timeouts.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/settings/test_background_tasks_startup_log_masking.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/sync_db/test_background_tasks_sync_db.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/core/sync_db/test_background_tasks_sync_db_fork.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/retry/test_background_tasks_retry_failed_bulk.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/retry/test_background_tasks_retry_failed_guards.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/retry/test_background_tasks_retry_sweep_ordering.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_after_commit.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_eager_bindings.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_index_has_executions.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_list_item_payload.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_newest_first_status.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_order_index.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_publish_validation.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_read_projection.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_retention_retries.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_savepoint_publish.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_service.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/executions/service/test_background_tasks_tz_columns.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/logs/purge/test_background_tasks_log_purge.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/logs/sink/test_background_tasks_log_context.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/logs/sink/test_background_tasks_log_sink.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/logs/sink/test_background_tasks_log_sink_loop.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/logs/sink/test_background_tasks_log_sink_nul.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_delivery_context.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_inprocess_sweep.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_concurrency.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_delivery.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_eager_platform.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_eager_serialization.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_fence_guard.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_guard_savepoint.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_publish_scope.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_retry_policy.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_swallowed_cancel.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/delivery/test_background_tasks_outbox_worker_task.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/loop/test_background_tasks_outbox_loop_interrupt.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/outbox/loop/test_background_tasks_outbox_thread_loops.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/web/api/test_background_tasks_admin_api.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/web/api/test_background_tasks_index_filters.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/web/api/test_background_tasks_log_api.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/web/api/test_background_tasks_page_clamp.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/web/api/test_background_tasks_pagination_bounds.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/web/api/test_background_tasks_task_status_api.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/web/api/test_background_tasks_users_ordering.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/inspector/test_background_tasks_index_worker_presence.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/inspector/test_background_tasks_worker_inspector.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/inspector/test_background_tasks_workers_endpoints.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/inspector/test_background_tasks_workers_uptime.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/runner/test_background_tasks_routes_override_api.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/runner/test_background_tasks_task_routing.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/runner/test_background_tasks_worker_settings.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_argument_json.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_execution_bindings.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_heartbeat.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_resource_status.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_resource_transport.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_result_json.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_signal_tenant_stamp.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_signals.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_sweep_stuck.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_task_progress.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_task_progress_audit.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_tracking_modes.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_worker_audit.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/signals/test_background_tasks_worker_audit_bookkeeping.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/tenancy/test_background_tasks_custom_bases.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/tenancy/test_background_tasks_execution_tenancy.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/tenancy/test_background_tasks_tenant_context.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/tenancy/test_background_tasks_worker_tenancy.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests/worker/tenancy/test_background_tasks_worker_tenancy_context.py +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/background_tasks_IndexPage.test.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/background_tasks_LogsTab.test.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/background_tasks_WorkerHealthBanner.test.tsx +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/outbox.test.ts +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/retry.test.ts +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/stub-fetch.ts +0 -0
- {simple_module_background_tasks-0.0.47 → simple_module_background_tasks-0.0.48}/tests-js/task-formatters.test.ts +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.48
|
|
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.48
|
|
27
|
+
Requires-Dist: simple-module-db==0.0.48
|
|
28
|
+
Requires-Dist: simple-module-hosting==0.0.48
|
|
29
|
+
Requires-Dist: simple-module-settings==0.0.48
|
|
30
30
|
Description-Content-Type: text/markdown
|
|
31
31
|
|
|
32
32
|
# simple_module_background_tasks
|
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import uuid
|
|
6
6
|
from datetime import datetime
|
|
7
|
-
from typing import Any
|
|
8
7
|
|
|
9
8
|
from pydantic import ConfigDict
|
|
10
9
|
from sqlmodel import SQLModel
|
|
@@ -20,7 +19,6 @@ class OutboxItem(SQLModel):
|
|
|
20
19
|
id: uuid.UUID
|
|
21
20
|
event_key: str
|
|
22
21
|
handler_name: str
|
|
23
|
-
payload: dict[str, Any] = {}
|
|
24
22
|
tenant_id: str | None = None
|
|
25
23
|
status: OutboxStatus
|
|
26
24
|
attempts: int
|
|
@@ -87,10 +87,13 @@ async def startup(app: FastAPI, module_name: str) -> None:
|
|
|
87
87
|
|
|
88
88
|
def install_durable_transport(app: FastAPI) -> None:
|
|
89
89
|
"""Make ``bus.publish_durable`` write to this module's outbox (GH #459)."""
|
|
90
|
+
from simple_module_core.principals import PRINCIPALS_KEY
|
|
91
|
+
|
|
90
92
|
from background_tasks.core.constants import OutboxMode
|
|
91
93
|
from background_tasks.outbox.sweep import start_sweep
|
|
92
94
|
from background_tasks.outbox.transport import OutboxTransport
|
|
93
95
|
from background_tasks.outbox.worker import use_bus
|
|
96
|
+
from background_tasks.worker.principals import configure_principals, use_principal_registry
|
|
94
97
|
|
|
95
98
|
bus = app.state.sm.event_bus
|
|
96
99
|
services = app.state.background_tasks
|
|
@@ -106,6 +109,9 @@ def install_durable_transport(app: FastAPI) -> None:
|
|
|
106
109
|
# An eager in-process dispatch delivers with the app's bus, which already
|
|
107
110
|
# carries every module's durable subscriptions.
|
|
108
111
|
use_bus(bus)
|
|
112
|
+
configure_principals(app.state.sm.settings)
|
|
113
|
+
factory = app.state.sm.db.session_factory
|
|
114
|
+
use_principal_registry(getattr(factory, "kw", {}).get("info", {}).get(PRINCIPALS_KEY))
|
|
109
115
|
|
|
110
116
|
|
|
111
117
|
async def start_invalidation_transport(app: FastAPI) -> None:
|
|
@@ -122,7 +128,14 @@ async def start_invalidation_transport(app: FastAPI) -> None:
|
|
|
122
128
|
documented cross-process limit as ``bind_event_bus`` above: a task that
|
|
123
129
|
invalidates a cache should do it through an API call or accept the TTL.
|
|
124
130
|
"""
|
|
131
|
+
from simple_module_hosting.installation import ensure_installation_id
|
|
132
|
+
|
|
133
|
+
from background_tasks.core.constants import DEFAULT_INVALIDATION_CHANNEL
|
|
125
134
|
from background_tasks.core.invalidation import RedisInvalidationTransport
|
|
135
|
+
from background_tasks.core.invalidation_channel import (
|
|
136
|
+
LEGACY_CHANNEL_BRIDGE,
|
|
137
|
+
installation_channel,
|
|
138
|
+
)
|
|
126
139
|
|
|
127
140
|
services = app.state.background_tasks
|
|
128
141
|
s = services.settings
|
|
@@ -134,13 +147,26 @@ async def start_invalidation_transport(app: FastAPI) -> None:
|
|
|
134
147
|
return
|
|
135
148
|
|
|
136
149
|
bus = app.state.sm.invalidation
|
|
137
|
-
|
|
150
|
+
channel = s.invalidation_channel
|
|
151
|
+
legacy_channel = None
|
|
152
|
+
if channel is None:
|
|
153
|
+
identity = await ensure_installation_id(app.state.sm.settings.database_url)
|
|
154
|
+
channel = installation_channel(identity)
|
|
155
|
+
if channel is None:
|
|
156
|
+
# The host defers failed startup hooks on a fresh database and replays
|
|
157
|
+
# them after setup migrations. Returning here would never retry.
|
|
158
|
+
raise RuntimeError("Invalidation broadcasting awaits settings table migrations")
|
|
159
|
+
legacy_channel = DEFAULT_INVALIDATION_CHANNEL
|
|
160
|
+
LEGACY_CHANNEL_BRIDGE.warn()
|
|
161
|
+
transport = RedisInvalidationTransport(
|
|
162
|
+
bus, s.broker_url, channel, legacy_channel=legacy_channel
|
|
163
|
+
)
|
|
138
164
|
await transport.start()
|
|
139
165
|
bus.set_transport(transport)
|
|
140
166
|
services.invalidation_transport = transport
|
|
141
167
|
logger.info(
|
|
142
168
|
"BackgroundTasks: invalidation transport on %r for channel(s) %s",
|
|
143
|
-
|
|
169
|
+
channel,
|
|
144
170
|
", ".join(bus.channels) or "(none subscribed)",
|
|
145
171
|
)
|
|
146
172
|
|
|
@@ -10,6 +10,9 @@ from __future__ import annotations
|
|
|
10
10
|
|
|
11
11
|
from enum import StrEnum
|
|
12
12
|
|
|
13
|
+
from simple_module_core.deprecation import deprecate
|
|
14
|
+
from simple_module_core.permissions import PermissionCatalogue
|
|
15
|
+
|
|
13
16
|
# ── Module identity ─────────────────────────────────────────────
|
|
14
17
|
MODULE_NAME = "background_tasks"
|
|
15
18
|
MODULE_DISPLAY_NAME = "BackgroundTasks"
|
|
@@ -33,8 +36,23 @@ ENV_REDIS_URL = "SM_REDIS_URL"
|
|
|
33
36
|
|
|
34
37
|
# ── Permissions ─────────────────────────────────────────────────
|
|
35
38
|
PERM_GROUP = "Background tasks"
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class Permissions(
|
|
42
|
+
PermissionCatalogue, group=PERM_GROUP, label_key="background_tasks.permission_group"
|
|
43
|
+
):
|
|
44
|
+
VIEW = "background_tasks.view"
|
|
45
|
+
MANAGE = "background_tasks.manage"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
deprecate(
|
|
49
|
+
"background_tasks PERM_* constants",
|
|
50
|
+
remove_in="0.0.50",
|
|
51
|
+
use="background_tasks.core.constants.Permissions",
|
|
52
|
+
)
|
|
53
|
+
PERM_VIEW = Permissions.VIEW
|
|
54
|
+
PERM_MANAGE = Permissions.MANAGE
|
|
55
|
+
|
|
38
56
|
|
|
39
57
|
# ── Routes ──────────────────────────────────────────────────────
|
|
40
58
|
API_PREFIX = "/api/background_tasks"
|
|
@@ -97,14 +115,7 @@ HEARTBEAT_MIN_INTERVAL_SECONDS = 30
|
|
|
97
115
|
TASK_STUCK_AFTER_ATTR = "stuck_after"
|
|
98
116
|
DEFAULT_PURGE_INTERVAL_SECONDS = 60 * 60 * 24
|
|
99
117
|
DEFAULT_RETENTION_DAYS = 14
|
|
100
|
-
|
|
101
|
-
# Redis pub/sub channel carrying the framework's cache invalidations. Namespaced
|
|
102
|
-
# so that two apps on one Redis *server* do not each act on the other's messages.
|
|
103
|
-
# The server, not the database: pub/sub ignores the logical DB index, so DBs 4 and
|
|
104
|
-
# 5 of one instance share this channel. Mostly that costs pointless reads, but it
|
|
105
|
-
# is not unconditionally harmless — an emptied cache is also what exposes
|
|
106
|
-
# ``UsersAuthProvider._version_still_current``'s fail-open branch, so rename it
|
|
107
|
-
# per app rather than relying on the DB number.
|
|
118
|
+
# Prefix for installation channels; also the legacy global channel until 0.1.0.
|
|
108
119
|
DEFAULT_INVALIDATION_CHANNEL = "simple_module.invalidation"
|
|
109
120
|
|
|
110
121
|
# ── Internal task names ─────────────────────────────────────────
|
|
@@ -90,17 +90,20 @@ a round trip on an open socket, not a connect.
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
class RedisInvalidationTransport:
|
|
93
|
-
"""Publishes
|
|
93
|
+
"""Publishes and listens on a channel plus an optional rolling-upgrade bridge.
|
|
94
94
|
|
|
95
95
|
Satisfies ``simple_module_core.invalidation.InvalidationTransport``
|
|
96
96
|
structurally — no import of the Protocol at runtime, so this file costs
|
|
97
97
|
nothing when the bus is unused.
|
|
98
98
|
"""
|
|
99
99
|
|
|
100
|
-
def __init__(
|
|
100
|
+
def __init__(
|
|
101
|
+
self, bus: InvalidationBus, url: str, channel: str, *, legacy_channel: str | None = None
|
|
102
|
+
) -> None:
|
|
101
103
|
self._bus = bus
|
|
102
104
|
self._url = url
|
|
103
105
|
self._channel = channel
|
|
106
|
+
self._channels = tuple(dict.fromkeys(c for c in (channel, legacy_channel) if c))
|
|
104
107
|
self._client = None
|
|
105
108
|
self._listener: asyncio.Task | None = None
|
|
106
109
|
self._warned = False
|
|
@@ -142,7 +145,8 @@ class RedisInvalidationTransport:
|
|
|
142
145
|
if self._client is None:
|
|
143
146
|
raise RuntimeError("RedisInvalidationTransport.start() was not called")
|
|
144
147
|
async with asyncio.timeout(PUBLISH_TIMEOUT_SECONDS):
|
|
145
|
-
|
|
148
|
+
for channel in self._channels:
|
|
149
|
+
await self._client.publish(channel, message)
|
|
146
150
|
|
|
147
151
|
async def stop(self) -> None:
|
|
148
152
|
"""Cancel the listener and close the client."""
|
|
@@ -175,7 +179,7 @@ class RedisInvalidationTransport:
|
|
|
175
179
|
try:
|
|
176
180
|
pubsub = self._client.pubsub()
|
|
177
181
|
async with asyncio.timeout(SUBSCRIBE_TIMEOUT_SECONDS):
|
|
178
|
-
await pubsub.subscribe(self.
|
|
182
|
+
await pubsub.subscribe(*self._channels)
|
|
179
183
|
await self._warm_publish_connection()
|
|
180
184
|
if self._warned:
|
|
181
185
|
logger.info("Invalidation listener reconnected to %r", self._channel)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Default installation channel and the temporary rolling-upgrade bridge."""
|
|
2
|
+
|
|
3
|
+
from simple_module_core.deprecation import deprecate
|
|
4
|
+
|
|
5
|
+
from background_tasks.core.constants import DEFAULT_INVALIDATION_CHANNEL
|
|
6
|
+
|
|
7
|
+
LEGACY_CHANNEL_BRIDGE = deprecate(
|
|
8
|
+
"global Redis invalidation channel bridge",
|
|
9
|
+
remove_in="0.1.0",
|
|
10
|
+
use="the database-derived installation channel",
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def installation_channel(installation_id: str | None) -> str | None:
|
|
15
|
+
"""No identity before migrations means local invalidation only."""
|
|
16
|
+
if installation_id is None:
|
|
17
|
+
return None
|
|
18
|
+
return f"{DEFAULT_INVALIDATION_CHANNEL}.{installation_id}"
|
|
@@ -18,8 +18,6 @@ from simple_module_core.settings_hydrate import RELATED_FIELDS_CTX
|
|
|
18
18
|
from background_tasks.core.config_guards import parse_task_routes
|
|
19
19
|
from background_tasks.core.constants import (
|
|
20
20
|
DEFAULT_BROKER_URL,
|
|
21
|
-
DEFAULT_INVALIDATION_CHANNEL,
|
|
22
|
-
DEFAULT_MAX_RETRIES,
|
|
23
21
|
DEFAULT_PURGE_INTERVAL_SECONDS,
|
|
24
22
|
DEFAULT_QUEUE,
|
|
25
23
|
DEFAULT_RESULT_BACKEND,
|
|
@@ -146,9 +144,10 @@ class CelerySettingsFields(LogSinkFields, WorkerDatabaseSettings):
|
|
|
146
144
|
broadcast_invalidations: bool = Field(
|
|
147
145
|
default=True, json_schema_extra={"requires_restart": True, "group": "Celery"}
|
|
148
146
|
)
|
|
149
|
-
invalidation_channel: str = Field(
|
|
150
|
-
default=
|
|
147
|
+
invalidation_channel: str | None = Field(
|
|
148
|
+
default=None,
|
|
151
149
|
min_length=1,
|
|
150
|
+
description="Leave unset to derive the channel from the database installation ID.",
|
|
152
151
|
json_schema_extra={"requires_restart": True, "group": "Celery"},
|
|
153
152
|
)
|
|
154
153
|
|
|
@@ -173,12 +172,6 @@ class CelerySettingsFields(LogSinkFields, WorkerDatabaseSettings):
|
|
|
173
172
|
le=3650,
|
|
174
173
|
description="Days to keep terminal task execution records (1-3650).",
|
|
175
174
|
)
|
|
176
|
-
max_retries: int = Field(
|
|
177
|
-
default=DEFAULT_MAX_RETRIES,
|
|
178
|
-
ge=0,
|
|
179
|
-
le=100,
|
|
180
|
-
description="Configured retry ceiling; individual tasks define their own policies (0-100).",
|
|
181
|
-
)
|
|
182
175
|
|
|
183
176
|
@field_validator("task_time_limit")
|
|
184
177
|
@classmethod
|
|
@@ -65,7 +65,7 @@ def forbid_localhost_broker_in_production(broker_url: str, result_backend: str)
|
|
|
65
65
|
bad = [
|
|
66
66
|
name
|
|
67
67
|
for name, url in (("broker_url", broker_url), ("result_backend", result_backend))
|
|
68
|
-
if "localhost" in url or "127.0.0.1" in url
|
|
68
|
+
if "localhost" in url or "127.0.0.1" in url or "[::1]" in url
|
|
69
69
|
]
|
|
70
70
|
if bad:
|
|
71
71
|
names = ", ".join(bad)
|
|
@@ -129,6 +129,7 @@ def async_database_url() -> str:
|
|
|
129
129
|
For the outbox dispatcher, whose durable handlers take an ``AsyncSession``.
|
|
130
130
|
"""
|
|
131
131
|
url = _resolve_url()
|
|
132
|
+
detect_provider(url)
|
|
132
133
|
if "+aiosqlite" in url or "+asyncpg" in url:
|
|
133
134
|
return url
|
|
134
135
|
if url.startswith("sqlite://"):
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"detail": {
|
|
53
53
|
"head_title": "Aufgabendetails",
|
|
54
|
-
"description": "Ausführung {id} · Versuch {attempt}
|
|
55
|
-
"attempt": "Versuch {attempt}
|
|
54
|
+
"description": "Ausführung {id} · Versuch {attempt}",
|
|
55
|
+
"attempt": "Versuch {attempt}",
|
|
56
56
|
"back_button": "Zurück zu den Ausführungen",
|
|
57
57
|
"retry_button": "Aufgabe erneut starten",
|
|
58
58
|
"meta": "Details",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"detail": {
|
|
53
53
|
"head_title": "Task detail",
|
|
54
|
-
"description": "execution {id} · attempt {attempt}
|
|
55
|
-
"attempt": "attempt {attempt}
|
|
54
|
+
"description": "execution {id} · attempt {attempt}",
|
|
55
|
+
"attempt": "attempt {attempt}",
|
|
56
56
|
"back_button": "Back to executions",
|
|
57
57
|
"retry_button": "Retry task",
|
|
58
58
|
"meta": "Details",
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import importlib.resources
|
|
6
5
|
import logging
|
|
7
6
|
import uuid
|
|
8
|
-
from pathlib import Path
|
|
9
7
|
from typing import TYPE_CHECKING
|
|
10
8
|
|
|
11
9
|
from fastapi import APIRouter
|
|
@@ -13,7 +11,6 @@ from simple_module_core.audit_links import AuditLinkRegistry
|
|
|
13
11
|
from simple_module_core.menu import MenuItem, MenuRegistry, MenuSection
|
|
14
12
|
from simple_module_core.module import ModuleBase, ModuleMeta
|
|
15
13
|
from simple_module_core.module_settings import register_module_settings
|
|
16
|
-
from simple_module_core.permissions import PermissionRegistry
|
|
17
14
|
|
|
18
15
|
from background_tasks.core.constants import (
|
|
19
16
|
_MODULE_SETTINGS,
|
|
@@ -24,11 +21,8 @@ from background_tasks.core.constants import (
|
|
|
24
21
|
MENU_LABEL,
|
|
25
22
|
MENU_ORDER,
|
|
26
23
|
MODULE_DISPLAY_NAME,
|
|
27
|
-
MODULE_NAME,
|
|
28
|
-
PERM_GROUP,
|
|
29
|
-
PERM_MANAGE,
|
|
30
|
-
PERM_VIEW,
|
|
31
24
|
VIEW_PREFIX,
|
|
25
|
+
Permissions,
|
|
32
26
|
)
|
|
33
27
|
|
|
34
28
|
if TYPE_CHECKING:
|
|
@@ -71,6 +65,8 @@ async def _resolve_execution_labels(db: AsyncSession, ids: list[str]) -> dict[st
|
|
|
71
65
|
class BackgroundTasksModule(ModuleBase):
|
|
72
66
|
"""Celery + Redis task queue with an admin UI for retrying failed/stuck tasks."""
|
|
73
67
|
|
|
68
|
+
permissions = Permissions
|
|
69
|
+
|
|
74
70
|
meta = ModuleMeta(
|
|
75
71
|
name=MODULE_DISPLAY_NAME,
|
|
76
72
|
route_prefix=API_PREFIX,
|
|
@@ -90,13 +86,6 @@ class BackgroundTasksModule(ModuleBase):
|
|
|
90
86
|
lambda s: BackgroundTasksServices(settings=s),
|
|
91
87
|
)
|
|
92
88
|
|
|
93
|
-
def register_permissions(self, registry: PermissionRegistry) -> None:
|
|
94
|
-
registry.add_group(
|
|
95
|
-
PERM_GROUP,
|
|
96
|
-
[PERM_VIEW, PERM_MANAGE],
|
|
97
|
-
label_key="background_tasks.permission_group",
|
|
98
|
-
)
|
|
99
|
-
|
|
100
89
|
def register_audit_links(self, registry: AuditLinkRegistry) -> None:
|
|
101
90
|
from simple_module_core.audit_links import AuditLink
|
|
102
91
|
|
|
@@ -158,10 +147,6 @@ class BackgroundTasksModule(ModuleBase):
|
|
|
158
147
|
view_router.include_router(logs_views)
|
|
159
148
|
view_router.include_router(views)
|
|
160
149
|
|
|
161
|
-
def locale_dirs(self) -> dict[str, Path]:
|
|
162
|
-
base = Path(str(importlib.resources.files(__package__) / "locales"))
|
|
163
|
-
return {MODULE_NAME: base}
|
|
164
|
-
|
|
165
150
|
async def on_startup(self, app: FastAPI) -> None:
|
|
166
151
|
"""Build the Celery app, install signal handlers, hand-off to worker."""
|
|
167
152
|
from background_tasks.core._lifecycle import startup
|
|
@@ -65,10 +65,11 @@ class OutboxService:
|
|
|
65
65
|
where = [OutboxMessage.status.in_(statuses), *self.scope.conditions()]
|
|
66
66
|
found = await paginate(
|
|
67
67
|
self.db,
|
|
68
|
-
select(OutboxMessage)
|
|
68
|
+
select(*(getattr(OutboxMessage, field) for field in OutboxItem.model_fields))
|
|
69
69
|
.where(*where)
|
|
70
70
|
.order_by(col(OutboxMessage.created_at).desc(), col(OutboxMessage.id)),
|
|
71
71
|
PageParams(page=page, per_page=per_page),
|
|
72
|
+
scalars=False,
|
|
72
73
|
)
|
|
73
74
|
return OutboxListResponse(
|
|
74
75
|
items=[OutboxItem.model_validate(r) for r in found.items],
|
|
@@ -21,7 +21,6 @@ both.
|
|
|
21
21
|
|
|
22
22
|
from __future__ import annotations
|
|
23
23
|
|
|
24
|
-
import inspect
|
|
25
24
|
import logging
|
|
26
25
|
import threading
|
|
27
26
|
from typing import Any
|
|
@@ -29,6 +28,7 @@ from typing import Any
|
|
|
29
28
|
from simple_module_core.events import EventBus
|
|
30
29
|
from simple_module_db import init_db
|
|
31
30
|
from simple_module_db.listeners import attach_session_listeners
|
|
31
|
+
from simple_module_db.principals import bind_principal_registry
|
|
32
32
|
from simple_module_db.query_filter import bind_engine_policy
|
|
33
33
|
from simple_module_db.tenant_cleanup import register_tenant_cleanup
|
|
34
34
|
from sqlalchemy.ext.asyncio import AsyncEngine, async_sessionmaker
|
|
@@ -40,6 +40,7 @@ from background_tasks.outbox.claim import OutboxPolicy
|
|
|
40
40
|
from background_tasks.outbox.dispatch import dispatch
|
|
41
41
|
from background_tasks.outbox.loop import run_on_worker_loop, stop_worker_loop, worker_loop_cache
|
|
42
42
|
from background_tasks.outbox.transport import WorkerOutboxTransport
|
|
43
|
+
from background_tasks.worker.principals import configure_principals, principal_revision
|
|
43
44
|
|
|
44
45
|
logger = logging.getLogger(__name__)
|
|
45
46
|
|
|
@@ -58,7 +59,13 @@ def worker_session_factory() -> async_sessionmaker[Any]:
|
|
|
58
59
|
url = sync_db.async_database_url()
|
|
59
60
|
policy = sync_db.engine_tenancy()
|
|
60
61
|
options = sync_db.database_options()
|
|
61
|
-
key = (
|
|
62
|
+
key = (
|
|
63
|
+
url,
|
|
64
|
+
policy.tenant_strict,
|
|
65
|
+
policy.default_tenant_id,
|
|
66
|
+
tuple(sorted(options.items())),
|
|
67
|
+
principal_revision(),
|
|
68
|
+
)
|
|
62
69
|
cache = worker_loop_cache()
|
|
63
70
|
cached: tuple[Any, async_sessionmaker[Any], AsyncEngine] | None = cache.get(_ENGINE_KEY)
|
|
64
71
|
if cached is not None and cached[0] == key:
|
|
@@ -79,6 +86,9 @@ def worker_session_factory() -> async_sessionmaker[Any]:
|
|
|
79
86
|
)
|
|
80
87
|
attach_session_listeners(state.sync_session_class)
|
|
81
88
|
bind_engine_policy(state.engine.sync_engine, policy)
|
|
89
|
+
from background_tasks.worker.principals import worker_principal_registry
|
|
90
|
+
|
|
91
|
+
bind_principal_registry(state.session_factory, worker_principal_registry())
|
|
82
92
|
cache[_ENGINE_KEY] = (key, state.session_factory, state.engine)
|
|
83
93
|
return state.session_factory
|
|
84
94
|
|
|
@@ -102,18 +112,6 @@ def use_bus(bus: EventBus | None) -> None:
|
|
|
102
112
|
_bus_override = bus
|
|
103
113
|
|
|
104
114
|
|
|
105
|
-
def _register(module: Any, bus: EventBus) -> None:
|
|
106
|
-
hook = module.register_event_handlers
|
|
107
|
-
params = inspect.signature(hook).parameters
|
|
108
|
-
accepts_app = "app" in params or any(
|
|
109
|
-
p.kind is inspect.Parameter.VAR_KEYWORD for p in params.values()
|
|
110
|
-
)
|
|
111
|
-
if accepts_app:
|
|
112
|
-
hook(bus, app=None)
|
|
113
|
-
else:
|
|
114
|
-
hook(bus)
|
|
115
|
-
|
|
116
|
-
|
|
117
115
|
def build_worker_bus() -> EventBus:
|
|
118
116
|
"""An ``EventBus`` carrying every installed module's subscriptions."""
|
|
119
117
|
from simple_module_core.discovery import discover_modules, topological_sort
|
|
@@ -125,7 +123,7 @@ def build_worker_bus() -> EventBus:
|
|
|
125
123
|
# module set the web process refuses is reported there, not here.
|
|
126
124
|
for module in topological_sort(discover_modules()):
|
|
127
125
|
try:
|
|
128
|
-
|
|
126
|
+
module.register_event_handlers(bus, app=None)
|
|
129
127
|
except Exception:
|
|
130
128
|
# One module's handler wiring needing the app must not stop every
|
|
131
129
|
# other module's durable events from being delivered. Logged once
|
|
@@ -157,6 +155,7 @@ def reset_worker_state() -> None:
|
|
|
157
155
|
with _lock:
|
|
158
156
|
_bus = None
|
|
159
157
|
_bus_override = None
|
|
158
|
+
configure_principals(None)
|
|
160
159
|
stop_worker_loop(_dispose_cached)
|
|
161
160
|
|
|
162
161
|
|
|
@@ -19,11 +19,9 @@ import { retryExecution } from '../ui/utils/retry';
|
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
21
|
execution: TaskDetail;
|
|
22
|
-
/** Configured retry ceiling — the denominator in "attempt 2 of 3". */
|
|
23
|
-
max_retries: number;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
function Detail({ execution
|
|
24
|
+
function Detail({ execution }: Props) {
|
|
27
25
|
const { t } = useT();
|
|
28
26
|
const { can } = usePermissions();
|
|
29
27
|
const retryable = RETRYABLE_STATUSES.has(execution.status) && can('background_tasks.manage');
|
|
@@ -60,7 +58,6 @@ function Detail({ execution, max_retries: maxRetries }: Props) {
|
|
|
60
58
|
{t(keys.background_tasks.detail.description, {
|
|
61
59
|
id: execution.id,
|
|
62
60
|
attempt,
|
|
63
|
-
max: maxRetries,
|
|
64
61
|
})}
|
|
65
62
|
</span>
|
|
66
63
|
}
|
|
@@ -90,7 +87,7 @@ function Detail({ execution, max_retries: maxRetries }: Props) {
|
|
|
90
87
|
<div className="mb-3.5 flex items-center justify-between gap-3 lg:hidden">
|
|
91
88
|
<StatusPill status={execution.status} className="px-3 py-1 text-xs" />
|
|
92
89
|
<span className="text-[13px] text-muted-foreground">
|
|
93
|
-
{t(keys.background_tasks.detail.attempt, { attempt
|
|
90
|
+
{t(keys.background_tasks.detail.attempt, { attempt })}
|
|
94
91
|
</span>
|
|
95
92
|
</div>
|
|
96
93
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// AUTO-GENERATED by `smpy openapi gen-types` from the BackgroundTasks module's /api
|
|
2
2
|
// operations — do not edit. Regenerate with `smpy openapi gen-types --module background_tasks`
|
|
3
3
|
// (`make gen-api-types` in the framework repo).
|
|
4
|
+
import { createApi } from '@simple-module-py/ui/lib/api';
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* This file was auto-generated by openapi-typescript.
|
|
6
8
|
* Do not make direct changes to the file.
|
|
@@ -299,13 +301,6 @@ export interface components {
|
|
|
299
301
|
event_key: string;
|
|
300
302
|
/** Handler Name */
|
|
301
303
|
handler_name: string;
|
|
302
|
-
/**
|
|
303
|
-
* Payload
|
|
304
|
-
* @default {}
|
|
305
|
-
*/
|
|
306
|
-
payload: {
|
|
307
|
-
[key: string]: unknown;
|
|
308
|
-
};
|
|
309
304
|
/** Tenant Id */
|
|
310
305
|
tenant_id?: string | null;
|
|
311
306
|
status: components["schemas"]["OutboxStatus"];
|
|
@@ -963,3 +958,5 @@ export interface operations {
|
|
|
963
958
|
};
|
|
964
959
|
};
|
|
965
960
|
}
|
|
961
|
+
|
|
962
|
+
export const api = createApi<paths>();
|