From 23b929ea10daded7447f806f8860447626e573a6 Mon Sep 17 00:00:00 2001 From: Shirshanka Das Date: Mon, 5 Sep 2022 11:53:39 -0700 Subject: [PATCH] feat(cli): report memory usage during ingest (#5828) --- .../src/datahub/ingestion/run/pipeline.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/metadata-ingestion/src/datahub/ingestion/run/pipeline.py b/metadata-ingestion/src/datahub/ingestion/run/pipeline.py index 009eecc4de6f8a..3413ea215a6dbe 100644 --- a/metadata-ingestion/src/datahub/ingestion/run/pipeline.py +++ b/metadata-ingestion/src/datahub/ingestion/run/pipeline.py @@ -1,5 +1,6 @@ import itertools import logging +import os import platform import sys import time @@ -7,6 +8,8 @@ from typing import Any, Dict, Iterable, List, Optional, cast import click +import humanfriendly +import psutil import datahub from datahub.configuration.common import PipelineExecutionError @@ -106,6 +109,13 @@ class CliReport(Report): py_exec_path: str = sys.executable os_details: str = platform.platform() + def compute_stats(self) -> None: + + self.mem_info = humanfriendly.format_size( + psutil.Process(os.getpid()).memory_info().rss + ) + return super().compute_stats() + class Pipeline: config: PipelineConfig