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

feat(ingestion): Adds support for memory profiling #8856

Merged
merged 21 commits into from
Oct 12, 2023

Conversation

pedro93
Copy link
Collaborator

@pedro93 pedro93 commented Sep 18, 2023

Adds memray as opt-in memory profiler for ingestion processes.
Tested locally that it works.

Recipe:

source:
  type: "file"
  config:
    path: "metadata-ingestion/examples/mce_files/bootstrap_mce.json"

flags:
  generate_memory_profiles: "/tmp/datahub/ingest"

Generates a binary flamegraph file such as file-None-file-2023_09_18-21_38_43.bin that can then be previewed as an HTML after running$ memray flamegraph file-None-file-2023_09_18-21_38_43.bin locally.

Sample output:

Screenshot 2023-09-18 at 21 43 39

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@pedro93 pedro93 requested review from treff7es and hsheth2 September 18, 2023 20:41
@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Sep 18, 2023
metadata-ingestion/setup.py Outdated Show resolved Hide resolved
metadata-ingestion/src/datahub/cli/ingest_cli.py Outdated Show resolved Hide resolved
metadata-ingestion/src/datahub/cli/ingest_cli.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@hsheth2 hsheth2 left a comment

Choose a reason for hiding this comment

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

a few final things, but would be good to get this merged!

metadata-ingestion/docs/dev_guides/profiling_ingestions.md Outdated Show resolved Hide resolved
metadata-ingestion/docs/dev_guides/profiling_ingestions.md Outdated Show resolved Hide resolved
metadata-ingestion/docs/dev_guides/profiling_ingestions.md Outdated Show resolved Hide resolved
metadata-ingestion/docs/dev_guides/profiling_ingestions.md Outdated Show resolved Hide resolved
metadata-ingestion/src/datahub/cli/ingest_cli.py Outdated Show resolved Hide resolved
@pedro93 pedro93 force-pushed the ps-ingestion-memory-profile branch from 3f1c93f to 4950e08 Compare October 11, 2023 17:53
import memray

with memray.Tracker(
f"{self.config.flags.generate_memory_profiles}/{self.config.run_id}.bin"
):
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't think this works - if generate_memory_profiles is not set, then we don't do anything

btw you can use contextlib.ExitStack or NullContext to conditionally enter a with clause

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was an oversight on my part. Already fixed.

@hsheth2
Copy link
Collaborator

hsheth2 commented Oct 11, 2023

@pedro93 code looks good, something about the markdown file is causing issues though

@pedro93 pedro93 merged commit f6e1312 into datahub-project:master Oct 12, 2023
@pedro93 pedro93 deleted the ps-ingestion-memory-profile branch October 12, 2023 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ingestion PR or Issue related to the ingestion of metadata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants