-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add Task processor #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Port `flagsmith/flagsmith-task-processor` - Port `waitfordb` management command - Introduce PostgreSQL for tests - Bump Poetry from 2.0.1 to 2.1.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a Task Processor feature and updates related configurations and utilities. Key changes include:
- New migrations to support task index updates, completion tracking, and recurring tasks.
- Introduction of a waitfordb management command and health check utilities.
- Updates to dependency versions, docker-compose settings, and management commands to support the new task processor.
Reviewed Changes
Copilot reviewed 56 out of 57 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/task_processor/migrations/0004_recreate_task_indexes.py | Introduces new index operations for tasks. |
| src/common/core/management/commands/waitfordb.py | Adds a command to wait for database readiness and migration application. |
| src/task_processor/migrations/0005_update_conditional_index_conditions.py | Updates conditional index conditions with new migration steps. |
| src/task_processor/apps.py | Registers a health check backend under specific settings. |
| src/task_processor/admin.py | Provides an admin interface for recurring tasks. |
| src/task_processor/migrations/0003_add_completed_to_task.py | Adds a completed field to tasks and updates index together settings. |
| src/task_processor/migrations/0002_healthcheckmodel.py | Adds a model dedicated to task processor health checking. |
| src/task_processor/health.py | Implements health check logic and backend for task processor status. |
| docker/docker-compose.local.yml | Configures local PostgreSQL service for development. |
| src/task_processor/migrations/0001_initial.py | Initial migration for the task processor models. |
| src/task_processor/migrations/0006_auto_20230221_0802.py | Adds recurring task models and unique constraints. |
| src/task_processor/decorators.py | Introduces decorators for task registration and execution. |
| src/task_processor/managers.py | Implements custom managers for task queries. |
| .github/workflows/python-test.yml | Adjusts test workflow steps to use make commands and PostgreSQL service. |
| src/task_processor/exceptions.py | Defines custom exceptions related to task processing. |
| pyproject.toml | Updates dependencies and package inclusion for the task processor. |
| settings/dev.py | Switches development database to PostgreSQL and adds task processor settings. |
| src/common/core/management/commands/start.py | Adds a sub-command for starting the Task Processor alongside the API. |
Files not reviewed (1)
- Makefile: Language not supported
39507be to
a44aad2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new task processor by porting features from flagsmith-task-processor and waitfordb, integrating PostgreSQL for tests, and bumping Poetry’s version.
- Adds migrations to update the Task model and indexes.
- Introduces a new waitfordb management command for database readiness.
- Enhances task processor functionality and its integrations (managers, decorators, admin, health checks).
Reviewed Changes
Copilot reviewed 58 out of 59 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/task_processor/migrations/0004_recreate_task_indexes.py | Adds migration to update indexes with PostgreSQL-specific SQL operations. |
| src/task_processor/migrations/0003_add_completed_to_task.py | Adds the "completed" field to the Task model and alters index together configuration. |
| src/task_processor/migrations/0002_healthcheckmodel.py | Creates a HealthCheckModel for processor health checks. |
| src/task_processor/migrations/0001_initial.py | Initial migration for Task and TaskRun models. |
| src/task_processor/managers.py | Implements custom managers for retrieving tasks to process. |
| src/task_processor/health.py | Implements processor health check and registers the health check backend. |
| src/task_processor/exceptions.py | Defines custom exceptions related to task processing. |
| src/task_processor/decorators.py | Provides decorators for registering asynchronous and recurring tasks. |
| src/task_processor/apps.py | Updates Django app configuration to register the health check backend conditionally. |
| src/task_processor/admin.py | Enhances admin interface for recurring tasks, including custom actions and display fields. |
| src/common/core/utils.py | Adds logging to the utility functions. |
| src/common/core/management/commands/waitfordb.py | Introduces a waitfordb command to wait for database connections and applied migrations. |
| src/common/core/management/commands/start.py | Extends the start command to support running the task processor alongside the API. |
| src/common/core/main.py | Refactors environment setup for the CLI entry point through a context manager. |
| settings/dev.py | Updates development settings to use PostgreSQL, configures task processor parameters, etc. |
| pyproject.toml | Updates dependencies (e.g., Django, backoff, drf-yasg, psycopg2) and bumps the Poetry version. |
| docker/docker-compose.local.yml | Provides a local Docker Compose configuration for PostgreSQL. |
| .github/workflows/python-test.yml | Updates GitHub Actions workflow to include a PostgreSQL service for testing. |
Files not reviewed (1)
- Makefile: Language not supported
Comments suppressed due to low confidence (1)
src/task_processor/migrations/0004_recreate_task_indexes.py:26
- Consider replacing the tuple argument with a keyword argument in the Q object by using models.Q(completed=False) to ensure the query condition works as expected.
condition=models.Q(("completed", False)),
Co-authored-by: Matthew Elwell <matthew.elwell@flagsmith.com>
flagsmith/flagsmith-task-processorwaitfordbmanagement command