-
Notifications
You must be signed in to change notification settings - Fork 0
Fixing web-driver cpu usage #139
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
Conversation
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
jinyoungbang
left a comment
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! Just see my comments and feel free to make changes or let it be!
| import re | ||
| import functools | ||
|
|
||
| def call_on_exit(method_name): |
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.
IMO decorator feels unnecessary and over engineered - unless we know we're gonna have more jobs/tasks that use the webdriver, I'd feel like just having a simple exit/kill method would be better. Regardless, if it works, no issues at all too!
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.
We might add a "recent news" section where we could scrape articles from the web and provide a summary of what's happening that week. Do you think it's a good idea?
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.
Yeah let's leave it for now - we can always iterate to change it later!
| try: | ||
| self.driver.quit() | ||
| except Exception: | ||
| pass |
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.
Can we raise some sort of error here?
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.
Added RuntimeError
What does this PR do?
Avoids initializing the web-driver until the
get_jobsfunction is called.TODO:
decoratorfor calling a function whenget_jobseither fails or finishes executing (see Deepseek's suggestion below)get_jobsto callself._close_driveron exitDeepseek's suggestion:
Type of change
Tests Performed
Screenshots
Additional Comments