-
Notifications
You must be signed in to change notification settings - Fork 2
IN-923 Raise exceptions for failed connection tests / IN-925 Add Makefile commands to run Carbon feeds #111
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
IN-923 Raise exceptions for failed connection tests / IN-925 Add Makefile commands to run Carbon feeds #111
Conversation
Why these changes are being introduced: * Raising exceptions for any failed connection tests stops the application from proceeding with the workflow once a connection test fails. This logic makes sense as the (1) a successful connection to the Data Warehouse is required for any Carbon run and (2) a successful connection to the Elements FTP server is required for any run Carbon run that involves FTP. How this addresses that need: * Exceptions are raised in the connection test functions of carbon.database.DatabaseEngine and carbon.app.DatabaseToFtpPipe. * CLI tests for failed connection tests are properly configured. Side effects of this change: * None Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/IN-923
Why these changes are being introduced: * Provide an easy way to execute runs of the 'people' and 'articles' feed as an ECS task. How this addresses that need: * Add Makefile commands to run 'people' and 'articles' feed Side effects of this change: * None Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/IN-925
|
Just a couple quick comments as I'm working through the PR:
I was able to quickly piece these together, and can totally see how lost in the shuffle of PR-ing, but just a comment on the PR process of helping the reviewer along for the ride. That said, the direct cloudwatch log links are helpful, and could see the results. I think it may come down to a matter of preference, but if the "How can a reviewer manually see the effects..." section is not actually running code, but just observing the output of something somewhat complex to setup, I might propose a 1) link to the lines of code that are getting tested, and 2) screenshot or log snippet of the output. This would avoid the 2 week window and could make the PR process a bit easier. But again, just a thought, and this works as-is. UPDATE: ...much like you did for the 2nd part of the PR! At a glance, can see from the screenshots that XML files exist. And, with the excellent confluence documentation, can go look at the files myself if needed. |
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.
Looks good to me!
I left a PR process comment in the PR, that is unrelated from the actual code changes.
I wasn't sure if this was the place to address it, so filed an issue, but I do wonder if the FTP upload error, accompanying a successful upload, may be some kind of hanging file handler and/or open connection? Given the timeout, it feels like it could be something like that.
| f"Failed to connect to the Symplectic Elements FTP server: {error}" | ||
| ) | ||
| logger.exception(error_message) | ||
| raise |
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.
+1 - think it's good that application bails given a connection error, as it cannot really do its work without it
| except Exception as error: | ||
| error_message = f"Failed to connect to the Data Warehouse: {error}" | ||
| logger.exception(error_message) | ||
| raise |
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.
Same here.
| def test_cli_database_connection_test_fails(caplog, nonfunctional_engine, runner): | ||
| with patch("carbon.cli.DatabaseEngine") as mocked_engine: | ||
| mocked_engine.return_value = nonfunctional_engine | ||
| result = runner.invoke(main, ["--run_connection_tests"]) | ||
| assert result.exit_code == 1 | ||
|
|
||
| assert "Failed to connect to the Data Warehouse" in caplog.text |
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.
To me, this is a nice test. The fixture nonfunctional_engine is clearly worded, indicating that it's doomed from the get-go, and the test confirms it.
|
@ghukill I updated the description on the PR above to address your comments (for future reference)! I appreciate your feedback. Regarding the 'non-errors', thank you for looking into it. I will take your thoughts into consideration for the next story which will focus on resolving this issue: [IN-924 Investigate error with custom method for running FTP file transfer](Investigate error with custom method for running FTP file transfer). |
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.
Looks good! Thanks for the PR updates.
What does this PR do?
A few sentences describing the overall goals of the pull request's commits.
Why are we making these changes? Is there more work to be done to fully
achieve these goals?
How can a reviewer manually see the effects of these changes?
For IN-923 Raise exceptions for failed connection tests:
ZeroDivisionError.database.py):1 / 0after line 113 ofcarbon.database.DatabaseEngine.run_connection_test()to force a raised exception: logapp.py):1 / 0after line 241 ofcarbon.app.DatabaseToFtpPipe.run_connection_test()to force a raised exception: logFor IN-925 Add Makefile commands for running 'people' and 'articles' feed as an ECS task:
Check
'people'feed run:HRDataFeed.xmlis uploaded to the Elements FTP server (with today's date 9/20):Check
'articles'feed run:Check the CloudWatch log for successful 'articles' feed run: log
See screenshot below showing that

AA_articles.xmlis uploaded to the Elements FTP server (with today's date 9/20):Note: If you are interested in accessing the Elements FTP server, please refer to the instructions in this Confluence document: Carbon | Developer Guide | How to access files uploaded to the Elements FTP server.
Includes new or updated dependencies?
NO
Developer
Code Reviewer
(not just this pull request message)