generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e96f824
Initial commit
jcadam14 e0da4ee
Added ProcessPoolExecutor and background tasks
jcadam14 c7867d5
Added pytest
jcadam14 02b10be
Added more pytest
jcadam14 f07e160
Merge branch 'main' into 173-multithread-submission-processing
jcadam14 145bbb3
Merge branch 'main' into 173-multithread-submission-processing
jcadam14 29e126d
Trying the asyncio.create_task, might not keep
jcadam14 5629420
Merge branch 'main' into 173-multithread-submission-processing
jcadam14 c456e6b
Fixed issues after merge and removed took out BANGs
jcadam14 2da74b0
Incorporated Le's changes for session
jcadam14 22025e7
Updated to use run_in_executor and updated pytests
jcadam14 ff2e79f
Forgot to add Pool Executor. Kind of important
jcadam14 6e95703
Merge branch 'main' into 173-multithread-submission-processing
jcadam14 d123f47
Updated so all repo functions expect a session
jcadam14 4a3acbf
Removed None from session methods
jcadam14 14a50ef
Updated to use 404s where agreed, changed to return Response
jcadam14 7968e38
Lots of updates to make things simpler and common across repo functions
jcadam14 afc4672
Updated regex check to throw RequestValidationError
jcadam14 2e47b3c
Linting
jcadam14 2ec5d0c
linting and fixed the regex bug
jcadam14 760ddb7
Changed pytest to fit with current use of api-commons
jcadam14 5cd7609
Changed pytest for ContactInfo regex texts and continued use of Value…
jcadam14 8951ba2
lock file
jcadam14 dd34de6
fix: NullPool to ensure db connection
lchen-2101 8183dd8
Merge branch '177-wip-204-no_content-response-likely-causing-500-erro…
jcadam14 17401ec
Merge branch 'main' into 173-multithread-submission-processing
jcadam14 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import asyncio | ||
import logging | ||
|
||
from sbl_filing_api.config import settings | ||
from sbl_filing_api.entities.models.dao import SubmissionDAO | ||
from sbl_filing_api.entities.repos import submission_repo as repo | ||
from sbl_filing_api.services.submission_processor import validate_and_update_submission | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def handle_submission(period_code: str, lei: str, submission: SubmissionDAO, content: bytes, exec_check): | ||
loop = asyncio.get_event_loop() | ||
try: | ||
coro = validate_and_update_submission(period_code, lei, submission, content, exec_check) | ||
loop.run_until_complete(coro) | ||
except Exception as e: | ||
logger.error(e, exc_info=True, stack_info=True) | ||
|
||
|
||
async def check_future(future, submission_id, exec_check): | ||
await asyncio.sleep(settings.expired_submission_check_secs) | ||
if not future.done(): | ||
future.cancel() | ||
exec_check["continue"] = False | ||
await repo.expire_submission(submission_id) | ||
logger.warning( | ||
f"Validation for submission {submission_id} did not complete within the expected timeframe, will be set to VALIDATION_EXPIRED." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?