Skip to content

Fix ModuleNotFoundError for tritonparse.fb in atexit cleanup#374

Closed
zhudada0120 wants to merge 1 commit intometa-pytorch:mainfrom
zhudada0120:fix_fb_code_issue
Closed

Fix ModuleNotFoundError for tritonparse.fb in atexit cleanup#374
zhudada0120 wants to merge 1 commit intometa-pytorch:mainfrom
zhudada0120:fix_fb_code_issue

Conversation

@zhudada0120
Copy link
Copy Markdown
Contributor

@zhudada0120 zhudada0120 commented Apr 7, 2026

Summary

This PR fixes an OSS-only shutdown error in TritonTraceHandler._cleanup().

When TRITONPARSE_TRACE_MANIFOLD is enabled, cleanup may try to import the fb-only uploader in OSS environments and print ModuleNotFoundError: No module named 'tritonparse.fb' during atexit, even though trace generation and parsing have already succeeded.

related issue:#373

Changes

  • import is_fbcode from shared_vars
  • gate the Manifold upload path in _cleanup() behind is_fbcode()

This keeps the existing internal upload behavior unchanged while skipping the fb-only uploader path in OSS.

Testing

image - ran `python /root/project/tritonparse/tests/test_add.py` in an OSS environment - confirmed the script still generates trace and parsed output successfully - confirmed the `atexit` cleanup no longer raises `ModuleNotFoundError` for `tritonparse.fb`

@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Apr 7, 2026

Hi @zhudada0120!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Apr 7, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 7, 2026
@zhudada0120
Copy link
Copy Markdown
Contributor Author

Hi @FindHao, PTAL. Thanks!

Copy link
Copy Markdown
Member

@FindHao FindHao left a comment

Choose a reason for hiding this comment

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

LGTM! thanks for capturing this

@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync bot commented Apr 7, 2026

@FindHao has imported this pull request. If you are a Meta employee, you can view this in D99848479.

Copy link
Copy Markdown
Contributor

@xuzhao9 xuzhao9 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@meta-codesync meta-codesync bot closed this in 2418f61 Apr 7, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync bot commented Apr 7, 2026

@FindHao merged this pull request in 2418f61.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants