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 build metrics report format with long placehold filenames #17679

Open
wants to merge 3 commits into
base: branch-25.02
Choose a base branch
from

Conversation

davidwendt
Copy link
Contributor

Description

Truncates filenames that appear as multiple placehold_placedhold_... in the Build Metrics Report.
Example show here: https://downloads.rapids.ai/ci/cudf/pull-request/17669/0710ad6/cuda12_x86_64.ninja_log.html (requires VPN).

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@davidwendt davidwendt added 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jan 3, 2025
@davidwendt davidwendt self-assigned this Jan 3, 2025
@davidwendt davidwendt requested a review from a team as a code owner January 3, 2025 14:29
@davidwendt davidwendt requested review from vyasr and mhaseeb123 January 3, 2025 14:29
@davidwendt
Copy link
Contributor Author

Here is what it looks like after this fix: https://downloads.rapids.ai/ci/cudf/pull-request/17679/fb12cda/cuda12_x86_64.ninja_log.html (VPN required)

@bdice
Copy link
Contributor

bdice commented Jan 3, 2025

Explaining this behavior for anyone who is curious: Conda uses a "placeholder" intentionally, to ensure that hardcoded paths in binaries are relocatable. On install, conda can replace hardcoded paths in a binary with the proper user path, but it cannot be longer than the original placeholder string because doing so would change the locations of content/symbols in the binary. It can be shorter and stop early with a \0.

I would prefer to use something like this:

import re

def replace_placeholder_patterns(input_string: str) -> str:
    pattern = r'(_h_env_placehold)[_placehold]+'
    return re.sub(pattern, r'\1...', input_string)

print(replace_placeholder_patterns("CMakeFiles/cudf.dir/opt/conda/conda-bld/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/include/rmm/logger_impl/logger.cpp.o"))

This gives output like:

CMakeFiles/cudf.dir/opt/conda/conda-bld/_h_env_placehold.../include/rmm/logger_impl/logger.cpp.o

Copy link
Member

@mhaseeb123 mhaseeb123 left a comment

Choose a reason for hiding this comment

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

Looks good. One small non-blocking question though, as format_file_name only returns replace_placeholder_patterns, can we just consolidate them? Would we need to make any other adjustments to the display name in the future to keep it in the current form?

@davidwendt
Copy link
Contributor Author

Looks good. One small non-blocking question though, as format_file_name only returns replace_placeholder_patterns, can we just consolidate them? Would we need to make any other adjustments to the display name in the future to keep it in the current form?

Right. I expect further updates to this function in the future and this will help keep them in one place.

@vyasr
Copy link
Contributor

vyasr commented Jan 6, 2025

Explaining this behavior for anyone who is curious: Conda uses a "placeholder" intentionally, to ensure that hardcoded paths in binaries are relocatable. On install, conda can replace hardcoded paths in a binary with the proper user path, but it cannot be longer than the original placeholder string because doing so would change the locations of content/symbols in the binary. It can be shorter and stop early with a \0.

I would prefer to use something like this:

import re

def replace_placeholder_patterns(input_string: str) -> str:
    pattern = r'(_h_env_placehold)[_placehold]+'
    return re.sub(pattern, r'\1...', input_string)

print(replace_placeholder_patterns("CMakeFiles/cudf.dir/opt/conda/conda-bld/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/include/rmm/logger_impl/logger.cpp.o"))

This gives output like:

CMakeFiles/cudf.dir/opt/conda/conda-bld/_h_env_placehold.../include/rmm/logger_impl/logger.cpp.o

JFYI the docs on this are at https://docs.conda.io/projects/conda-build/en/latest/resources/make-relocatable.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants