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
173 multithread submission processing #174
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
async def validate_and_update_submission(period_code: str, lei: str, submission: SubmissionDAO, content: bytes): | ||
async def validate_and_update_submission( | ||
period_code: str, lei: str, submission: SubmissionDAO, content: bytes, exec_check: dict | ||
): | ||
validator_version = imeta.version("regtech-data-validator") | ||
submission.validation_ruleset_version = validator_version | ||
submission.state = SubmissionState.VALIDATION_IN_PROGRESS | ||
submission = await update_submission(submission) |
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.
why isn't this one in the with context block?
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.
Because I was lazy? Updated. Removed the concept of the update function and the get_submission function from having a None session. Calling code will now be expected to handle that piece.
Updated the pytests now for all that, too
@@ -109,6 +110,13 @@ async def update_submission(submission: SubmissionDAO, incoming_session: AsyncSe | |||
return await upsert_helper(session, submission, SubmissionDAO) | |||
|
|||
|
|||
async def expire_submission(submission_id: int): | |||
session = SessionLocal() |
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.
shouldn't we use the with context here as well?
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.
Yup, updated.
validator_version = imeta.version("regtech-data-validator") | ||
submission.validation_ruleset_version = validator_version | ||
submission.state = SubmissionState.VALIDATION_IN_PROGRESS | ||
submission = await update_submission(submission) |
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.
don't you need to pass the session into the argument?
Man my brain isn't in it this week apparently. Instead of trying to be fancy, I decided to make the update_submission and get_submission param order just like every other function in the submission_repo, which is first the session, then the things you're getting/updating. I then changed all the places using these calls to just pass in the objects, again like every other call does. Updated all the pytests to follow the same idea. Three other updates:
|
for the 2nd bullet point, I've always just done for the 3rd bullet point; keep it ValueError, I just tried it, and it gets thrown correctly as the RequestValidationError, which then gets correctly handled by the request validation error handler. |
…r' into 173-multithread-submission-processing
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.
LGTM
Closes #173
Closes #181