The current MongoUtil implementation has one mongo_collection instance
variable that can be set to either the jobs collection or the logs collection
depending on which method was called last. Methods that don't explicitly
choose the collection themselves will use the collection set by whichever
method was most recently called, which might be the wrong collection.
This commit makes two separate variables and ensures the right
collection is being used for each method. It also deletes a number of
unused methods.
Jira Ticket / Github Issue
[n/a] Added the Jira Ticket to the title of the PR e.g. (DATAUP-69 Adds a PR template)
Testing Instructions
Details for how to test the PR:
[x] Tests pass in Github Actions and locally
[x] Changes available by spinning up a local test suite
[n/a] I have commented my code, particularly in hard-to-understand areas
[n/a] I have made corresponding changes to the documentation
[?] My changes generate no new warnings - lots of warnings
[n/a] I have added tests that prove my fix is effective or that my feature works - I could technically add a test, but it'd be very weird and wouldn't make a lot of sense IMO
[x] New and existing unit tests pass locally with my changes
[n/a] Any dependent changes have been merged and published in downstream modules
[x] I have run Black and Flake8 on changed Python Code manually or with git precommit (and the Github Actions build passes)
Updating Version and Release Notes (if applicable)
This pull request introduces 1 alert when merging 4c75bda28352fafaa6f88a63da5efe7cfd4f5c54 into 18408b25510383b44025c9dde9cf4d4813977f52 - view on LGTM.com
Description of PR purpose/changes
The current MongoUtil implementation has one
mongo_collection
instance variable that can be set to either the jobs collection or the logs collection depending on which method was called last. Methods that don't explicitly choose the collection themselves will use the collection set by whichever method was most recently called, which might be the wrong collection.This commit makes two separate variables and ensures the right collection is being used for each method. It also deletes a number of unused methods.
Jira Ticket / Github Issue
Testing Instructions
Dev Checklist:
Updating Version and Release Notes (if applicable)