-
Notifications
You must be signed in to change notification settings - Fork 479
DCA-1016: Confluence prepare data script update #657
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
|
|
||
| import urllib3 | ||
|
|
||
| from multiprocessing import cpu_count |
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.
Not used import.
| @@ -1,14 +1,17 @@ | |||
| import random | |||
| import string | |||
|
|
|||
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.
There are a bunch of missing imports related to the print_timing decorator.
| ENGLISH_GB = 'en_GB' | ||
|
|
||
|
|
||
| def print_timing(message, sep='-'): |
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.
This is a code duplication. jsm_prepare_data already has this. Need to extract this decorator to a common place, e.g. introduce new util file for prepare_data scripts.
| dataset[BLOGS] = __get_blogs(perf_user_api, 5000) | ||
|
|
||
| def __get_pages_blogs(func): | ||
| return func(perf_user_api, 5000) |
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.
With this approach, we break the possibility to modify the number of pages and blogs separately.
Also, the code is quite hard to understand.
Let's try something more simple and straight forward like:
pool = ThreadPool(processes=2)
async_pages = pool.apply_async(__get_pages, (perf_user_api, 5000))
async_blogs = pool.apply_async(__get_blogs, (perf_user_api, 5000))
async_pages.wait()
async_blogs.wait()
dataset[PAGES] = async_pages.get()
dataset[BLOGS] = async_blogs.get()
| @print_timing('Creating dataset started') | ||
| def __create_data_set(rest_client, rpc_client): | ||
| dataset = dict() | ||
| dataset = dict([]) |
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.
Why this line was changed?
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.
probably it is just my mistake
No description provided.