Skip to content
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

Fix performance_report when used with %%time or %%timeit magic #5463

Merged
merged 3 commits into from
Oct 27, 2021

Conversation

eriknw
Copy link
Member

@eriknw eriknw commented Oct 26, 2021

This takes a narrow approach and only attempts to handle when performance_report is used within %%time and %%timeit magics.

@fjetter
Copy link
Member

fjetter commented Oct 26, 2021

FWIW we have another function which tries to determine the code without explicit stacklevel, see

def _get_computation_code() -> str:

I'm wondering if this would work for this problem and we can reuse

@eriknw
Copy link
Member Author

eriknw commented Oct 26, 2021

@fjetter I gave client._get_computation_code a try and it seems to work.

My concern with using it though is that the stacklevel argument is user-facing in performance_report and is now ignored. Exposing stacklevel allows users to create their own context managers or functions that can use performance_report.

I think I'll add stacklevel as an optional argument to client._get_computation_code.

@eriknw
Copy link
Member Author

eriknw commented Oct 26, 2021

I think this is ready. The test failures appear unrelated. CC @ncclementi

Copy link
Member

@fjetter fjetter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @eriknw !

@fjetter fjetter merged commit 3e755fd into dask:main Oct 27, 2021
zanieb pushed a commit to zanieb/distributed that referenced this pull request Oct 28, 2021
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.

Performance report Calling Code wrong when using %%time
2 participants