Skip to content

Commit

Permalink
Avoid memory leak warnings from pypdfium2 (#1902)
Browse files Browse the repository at this point in the history
* Import `pypdfium2` early to ensure the `atexit` registered by `pypdfium2` is invoked after our `after_pipeline` method is.

Closes #1864

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/nv-morpheus/Morpheus/blob/main/docs/source/developer_guide/contributing.md).
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - David Gardner (https://github.com/dagardner-nv)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: #1902
  • Loading branch information
dagardner-nv authored Sep 25, 2024
1 parent c24ca43 commit 9a360b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/llm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
import time

import click
# pypdfium2 utilizes an atexit handler to perform cleanup, importing here to ensure that handler is registered before
# after_pipeline is, and thus is executed after after_pipeline is invoked. This avoids memory leak warnings at shutdown.
# https://github.com/nv-morpheus/Morpheus/issues/1864
import pypdfium2 # pylint: disable=unused-import # noqa: F401

from llm.agents import run as run_agents
from llm.completion import run as run_completion
Expand Down

0 comments on commit 9a360b2

Please sign in to comment.