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

[API] Support Memray profiling #5703

Merged
merged 5 commits into from
Jun 4, 2024
Merged

Conversation

alonmr
Copy link
Member

@alonmr alonmr commented Jun 3, 2024

Memory profiling MLRun API with Memray

This PR basically ports #5570 but in bash instead of python because we want to run the API straight from uvicorn CLI instead of a wapper python process.
Also added support to specify extra flags as some may be useful e.g. --trace-python-allocators to help finding leaks.

Comment on lines +20 to +21
# Check if the mlrun memray is set to a true value
if [[ -n "$MLRUN_MEMRAY_LOWER" && ( "$MLRUN_MEMRAY_LOWER" == "1" || "$MLRUN_MEMRAY_LOWER" == "true" || "$MLRUN_MEMRAY_LOWER" == "yes" || "$MLRUN_MEMRAY_LOWER" == "on" )]]; then
Copy link
Member

Choose a reason for hiding this comment

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

A bit more readable

Suggested change
# Check if the mlrun memray is set to a true value
if [[ -n "$MLRUN_MEMRAY_LOWER" && ( "$MLRUN_MEMRAY_LOWER" == "1" || "$MLRUN_MEMRAY_LOWER" == "true" || "$MLRUN_MEMRAY_LOWER" == "yes" || "$MLRUN_MEMRAY_LOWER" == "on" )]]; then
# Check if the mlrun memray is set to a true value
mlrun_memray_enabled() {
[[ -n "$MLRUN_MEMRAY_LOWER" && ( "$MLRUN_MEMRAY_LOWER" == "1" || "$MLRUN_MEMRAY_LOWER" =~ ^(true|yes|on)$ ) ]]
}
if mlrun_memray_enabled; then

@liranbg liranbg merged commit f580138 into mlrun:development Jun 4, 2024
11 checks passed
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.

None yet

3 participants