-
Notifications
You must be signed in to change notification settings - Fork 5
Refactor PIINVOICE so env vars are fetched at start of billing pipeline. #179
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
base: main
Are you sure you want to change the base?
Conversation
63d9226 to
6d1bdef
Compare
|
@QuanMPhm can be merged with main now |
| - NewPICreditProcessor | ||
| """ | ||
|
|
||
| chrome_binary_location: str |
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.
Could you move this arg below the constants. In this codebase, the conventional structure is class constants, then variables, then functions
| chrome_binary_location = os.environ.get( | ||
| "CHROME_BIN_PATH", "/usr/bin/chromium" | ||
| ) | ||
| if not os.path.exists(chrome_binary_location): |
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.
You do not need to move this check to process_report.py. We only want to move the fetching of the env var. Error checking can stay in the invoice class for now.
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.
You should add CHROME_BIN_PATH in REQUIRED_ENV_VARS
process_report/process_report.py
Outdated
| def main(): | ||
| """Remove non-billable PIs and projects""" | ||
|
|
||
| chrome_binary_location = os.environ.get("CHROME_BIN_PATH", "/usr/bin/chromium") |
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.
Related to the adding CHROME_BIN_PATH to REQUIRED_ENV_VARS, you should have the env var fetched after the env vars have been validated
…ipeline. This makes use of `required_env_vars()`.
I am now a contributor to this PR as well
| subprocess.run( | ||
| [ | ||
| CHROME_BIN_PATH, | ||
| os.environ.get("CHROME_BIN_PATH", "/usr/bin/chromium"), |
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.
What was the motivation for this change? I think it's generally better practice to read your environment variables early, rather than doing it inline like this.
Closes #168. Adhere to testing best practices as outlined in #159 (comment) and #168 (comment). Modify utils.py to accommodate changes.