Skip to content

Conversation

@opopovss
Copy link
Contributor

No description provided.

@opopovss opopovss self-assigned this Jul 30, 2021
@opopovss opopovss requested review from astashys and mmizin as code owners July 30, 2021 11:05

import urllib3

from multiprocessing import cpu_count
Copy link
Collaborator

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

Copy link
Collaborator

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='-'):
Copy link
Collaborator

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)
Copy link
Collaborator

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()

@opopovss opopovss requested a review from ometelytsia August 2, 2021 09:36
@print_timing('Creating dataset started')
def __create_data_set(rest_client, rpc_client):
dataset = dict()
dataset = dict([])
Copy link
Collaborator

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?

Copy link
Contributor Author

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

@opopovss opopovss merged commit 63ce012 into dev Aug 4, 2021
@opopovss opopovss deleted the confluence/dca-1016-prepare-data-script-improve branch August 4, 2021 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants