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
REFACTOR-#3257: Move logging and caching to the gen_data function #7046
REFACTOR-#3257: Move logging and caching to the gen_data function #7046
Conversation
… function Signed-off-by: arunjose696 <arunjose696@gmail.com>
4da597f
to
f51b046
Compare
@anmyachev, any comments? |
nrows, ncols, rand_low, rand_high | ||
) | ||
) | ||
data = gen_int_data(nrows, ncols, rand_low, rand_high).copy() |
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.
Is gen_int_data
used anywhere else? If not, we could remove it.
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 function would be called from gen_data function as data_generator can be gen_int_data.
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.
ok
asv_bench/benchmarks/utils/common.py
Outdated
assert data_type in type_to_generator | ||
data_generator = type_to_generator[data_type] | ||
|
||
data = data_generator(nrows, ncols, rand_low, rand_high) | ||
data = data_generator(nrows, ncols, rand_low, rand_high, cache_key) |
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.
and remove that new line from the lower level functions?
data = data_generator(nrows, ncols, rand_low, rand_high, cache_key) | |
data = data_generator(nrows, ncols, rand_low, rand_high, cache_key) | |
data_cache[cache_key] = weakdict(data) |
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.
Done
asv_bench/benchmarks/utils/common.py
Outdated
) | ||
) | ||
data = gen_int_data(nrows, ncols, rand_low, rand_high).copy() | ||
data = gen_data("int", nrows, ncols, rand_low, rand_high).copy() |
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 call a higher level function from a lower level function? gen_int_data
will be called anyway, right?
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.
If we call gen_int_data the data wouldnt be cached as the caching logic has been moved to get_data, Thus I figured calling gen_data higher level function would be better to cache data for later.
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.
If we call gen_int_data the data wouldnt be cached as the caching logic has been moved to get_data,
That's ok, we shouldn't use a low level function if there is a way to use it through a high level function.
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.
So I dont need to make any changes here right? (As gen_data higher level function is called)
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.
In fact, we should leave this line as it was before, imagine the execution flow, we design it so that it starts with function gen_data
, since it contains additional caching functionality. If the function of the lower part of the flow (for example, gen_str_int_data
) calls the upper one, then the flow is not unidirectional (this is usually more difficult to work with and understand).
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.
Got it, Done
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.
Thanks!
…ired Signed-off-by: arunjose696 <arunjose696@gmail.com>
c0d2868
to
5016902
Compare
4d03c40
to
80c0147
Compare
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.
LGTM!
asv job failed with |
Co-authored-by: Anatoly Myachev <anatoliimyachev@mail.com> Signed-off-by: arunjose696 <arunjose696@gmail.com>
80c0147
to
f53c7bf
Compare
What do these changes do?
flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
git commit -s
gen_data
function #3257docs/development/architecture.rst
is up-to-date