-
Notifications
You must be signed in to change notification settings - Fork 34
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
FC-73 XQueue add fields to submission model (Feature: SubmissionQueueRecord - Gradual Migration from Xqueue System) #283
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, @leoaulasneo98! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
@leoaulasneo98! Looks like you're contributing on behalf of Aulasneo -- if you haven't already, please have your manager reach out to [email protected] to have you added to our existing entity CLA. Thanks! |
@leoaulasneo98 could you ensure you get tests passing on this PR? |
Sure Sarina already checked it. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #283 +/- ##
==========================================
+ Coverage 93.53% 94.54% +1.01%
==========================================
Files 18 18
Lines 1995 2310 +315
Branches 90 98 +8
==========================================
+ Hits 1866 2184 +318
+ Misses 118 115 -3
Partials 11 11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@leoaulasneo98 could I ask that you comment on your PR rather than via email? The alerts I'm getting are kind of hard to follow. |
Hello Sarina, yes I apologize. I received the alert by email and responded there and then I realized it was a comment in the PR. |
0682d7a
to
731ce57
Compare
This commit updates the XQueue Migration ADR to be more accessible while maintaining critical technical information. Key changes include: - Streamline context section focusing on core system limitations - Reorganize decision section with clearer structure - Add implementation approach section for gradual migration - Maintain technical details in consequences section - Keep all original references for further documentation Part of the XQueue migration initiative. refactor: squashed migrations - Delete all migrations - Run again makemigrations - Test in secure environment refactor: change submission queue record name functionalities - Change SubmissionQueueManager to ExternalGraderDetailManager - Change create_submission_queue_record to create_external_grader_detail - Change validation to queue name in create_submission - Remove unnecessary test to check queue name error refactor(submissions): Rename SubmissionQueueRecord to ExternalGraderDetail - Rename model SubmissionQueueRecord to ExternalGraderDetail - Update all references in Python files - Create Django migration for model renaming - Update related imports and references feat: add ADR for SubmissionQueueRecord migration from XQueue Add Architecture Decision Record (ADR) documenting the design and implementation of the SubmissionQueueRecord model as part of the gradual migration from XQueue to edx-submissions. This ADR covers: - Context of current XQueue architecture - Technical details of new model implementation in edx submissions - Migration and compatibility considerations - Impact analysis and consequences feat: add architecture decisions to documentation - Create new decisions folder - Configurate in index.rst test: add validation tests for SubmissionQueueRecord state transitions - Add test_clean_invalid_transitions to verify error cases: - pending -> retired (not allowed) - pending -> invalid_status - pulled -> pending (not allowed) - failed -> retired (not allowed) - Enhance test_clean_valid_transitions with proper assertions This improves test coverage for state transition validations. fix: change validation SubmissionQueueRecord clean method - Add an optional status can_transition_to - Implement old status in clean method This resolves a bug in the implementation of transition validation when using the clean method. fix: remove try except in test_clean_new_instance - Remove unnecessary try/except in test_clean_new_instance - Add validations when new queue record call clean method - Extend coverage measure in test_models test: Add tests to extend coverage for SubmissionQueueRecord model - Status transition rules - Failure count tracking - Queue length calculations - Submission retrieval logic The new tests improve the robustness of the submissions app by covering. docs: Improve create_submission docstring formatting - Fix Sphinx documentation warnings - Correct formatting and indentation issues - Clarify parameter and return value descriptions Resolves documentation build warnings related to: - Inline strong start-string without end-string - Unexpected indentation fix: correct docstring formatting in create_submission - Add proper indentation and blank lines between sections - Fix example code block formatting - Replace >>> with ... for continued lines in example - Ensure consistent spacing throughout docstring This resolves the ReadTheDocs build failure and docstring formatting warning. fix: code style and quality improvements - Fix pylint warnings: - Remove protected access warnings in test files - Remove pointless string statements - Add missing final newlines - Fix isort import ordering in: - api.py - test_models.py - test_api.py - Fix pycodestyle issues: - Remove extra blank lines - Fix operator spacing - Add proper spacing before inline comments - Fix long lines in migration files - Fix line spacing in test files - Fix docstring formatting in api.py create_submission method Testing: make test_quality passes without warnings feat: add grading metadata fields to submission queue record - Add grader_file_name CharField (128 chars max) with empty default - Add points_possible PositiveIntegerField with default value of 1 - Update create_submission_queue_record to handle new fields fix: Remove duplicate nested create_submission function definition - Removes the redundant nested function definition feat: add nullable pullkey and grader_reply to Submission model feat(SubmissionQueueRecord): add pullkey and grader_reply fields - Add pullkey CharField(128) for tracking submission processing key - Add grader_reply TextField to store grader's response - Fields support queue processing and feedback management to xwatcher test: add comprehensive tests for Submission and SubmissionQueueRecord models Add missing test suite for Submission model and add new tests for SubmissionQueueRecord: Submission model tests (previously non-existent): - Basic model functionality (creation, retrieval) - String and repr representations - Large answer handling - Field mutability behavior - Submission ordering - Soft deletion mechanism - JSON serialization of answers SubmissionQueueRecord model tests: - Default status and initialization - Valid and invalid status transitions - Failure count tracking - Record processability logic - Queue name validation - One-to-one relationship with Submission - Status time updates Updates: - Fix repr test to handle UUID and string conversions - Document actual mutability behavior - Add validation for large answers - Ensure proper status transitions and timing - Verify queue processing logic The test suite ensures both models work correctly together and maintain data integrity through their lifecycle. Note: This commit adds the first test coverage for the Submission model, which previously lacked any automated testing. refactor: update submission queue record tests - Update test cases to use new public create_submission_queue_record function - Update assertions to use SubmissionQueueCanNotBeEmptyError instead of ValueError - Adjust test function parameters to match new interface (queue_name and files) - Add new test cases for empty queue_name validation The changes ensure test coverage for: - Direct queue record creation with valid and invalid inputs - Integration with create_submission function - Multiple submission queue records - Error handling scenarios fix: add blank line in models - This fixed the pylint warning feat(error): add SubmissionQueueCanNotBeEmptyError class error - This class is to is raised when queue name is empty fix: improve submission queue record validation - Update condition for creating submission queue record to properly check for queue_name - Use `event_data.get()` for safer dictionary access - Change ValueError to SubmissionQueueCanNotBeEmptyError for more specific error handling - Add proper validation in parent function to prevent None access errors The changes ensure that: 1. Queue name validation is more robust 2. Error handling is more specific and clear 3. Null checks are properly implemented Test coverage remains unchanged. refactor(submission): simplify queue record creation with explicit field - Replace dynamic unpacking of event_data with explicit queue_name field - Remove unnecessary field expansion to improve code clarity and maintainability test: add queue record unit and integration tests - Add unit tests for _create_submission_queue_record helper function - Basic queue record creation - Queue name validation - Database error handling - Add integration tests with create_submission - Queue record creation via submission creation - Multiple queue records with same name - Error handling with missing queue name - Database error integration testing Organized tests into clearly separated unit and integration sections for better maintainability and clarity. feat: add submission queue record functionality - Add _create_submission_queue_record helper function to handle queue record creation - Modify create_submission to accept event_data as kwargs - Update documentation to reflect new parameters and functionality - Allow dynamic field assignment using event_data kwargs in queue record creation The main changes: - Added ability to create SubmissionQueueRecord with dynamic fields - Improved error handling for queue record creation - Made event_data more flexible using kwargs pattern - Maintained backwards compatibility with existing submission creation feat(submissions): add SubmissionQueueRecord model - Add SubmissionQueueManager to process queries - Replace multiple timestamps with a single status_time field - Introduce explicit state machine for submission processing - Add atomic state transitions with validation - Optimize database indexes for queue operations Key changes: - Add STATUS_CHOICES and VALID_TRANSITIONS for state management - Consolidate pull_time, push_time, return_time into status_time - Add transaction-safe update_status() method - Improve queue manager with safer submission retrieval - Add validation for state transitions - Optimize indexes for common query patterns The changes maintain backwards compatibility with existing queue processing while providing a more robust and maintainable approach to state management.
527d0c2
to
f1d19f4
Compare
@leoaulasneo98 - did your team review this ? I don't see any comments from anyone on the PR |
@sarina They have my go-ahead. |
Thanks folks! I'll review by end of day Wednesday. |
FC-73 Feature: SubmissionQueueRecord - Gradual Migration from Xqueue System
Description
This pull request introduces the
SubmissionQueueRecord
model as part of a gradual migration of the Open edX submission queueing system (xqueue) towards a more robust and maintainable submission processing system.Motivation
The current xqueue system requires a strategic update to:
Key Improvements
Model Enhancements
SubmissionQueueRecord
with:status_time
)New Fields Added
queue_name
: Identifies processing queuestatus
: Current submission queue statestatus_time
: Unified timestamp for state trackingpullkey
: Submission processing tracking keygrader_file_name
: Grading file metadatagrader_reply
: Grader response storagepoints_possible
: Maximum possible pointsQueue Processing Improvements
SubmissionQueueManager
for queue query processingTechnical Details
State Management
STATUS_CHOICES
VALID_TRANSITIONS
update_status()
methodError Handling
SubmissionQueueCanNotBeEmptyError
event_data.get()
Testing Strategy
Comprehensive test coverage includes:
Next Phases
Planned Developments
Open edX Compliance
Adheres to Open edX standards:
Performance Considerations
BREAKING CHANGES: None. Designed to be fully compatible with existing systems.