From 2d89fdce5171f674b00b77c1f255200dba11beb5 Mon Sep 17 00:00:00 2001 From: Sonic Build Admin Date: Tue, 21 Jan 2025 19:58:03 +0000 Subject: [PATCH] Remove debug dump import by default #### What I did Remove debug dump import by default, Starting 202411, debug dump started to import libdashapi to parse DASH objects. Keeping this in default import path is causing CLI execution time to increase. #### How I did it Make the import on-demand #### How to verify it UT and verified on the image #### Previous command output (if the output of a command-line utility has changed) #### New command output (if the output of a command-line utility has changed) --- utilities_common/helper.py | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/utilities_common/helper.py b/utilities_common/helper.py index c9f0c3a956..8cd4f8080f 100644 --- a/utilities_common/helper.py +++ b/utilities_common/helper.py @@ -1,5 +1,3 @@ -from dump.match_infra import MatchEngine, MatchRequest, ConnectionPool -from dump.match_helper import get_matched_keys from .db import Db import copy @@ -20,18 +18,19 @@ def get_port_acl_binding(db_wrap, port, ns): if not isinstance(db_wrap, Db): raise Exception("db_wrap object is not of type utilities_common.Db") - conn_pool = ConnectionPool() + from dump import match_infra, match_helper + conn_pool = match_infra.ConnectionPool() conn_pool.fill(ns, db_wrap.db_clients[ns], db_wrap.db_list) - m_engine = MatchEngine(conn_pool) - req = MatchRequest(db="CONFIG_DB", - table=ACL, - key_pattern="*", - field="ports@", - value=port, - ns=ns, - match_entire_list=False) + m_engine = match_infra.MatchEngine(conn_pool) + req = match_infra.MatchRequest(db="CONFIG_DB", + table=ACL, + key_pattern="*", + field="ports@", + value=port, + ns=ns, + match_entire_list=False) ret = m_engine.fetch(req) - acl_tables, _ = get_matched_keys(ret) + acl_tables, _ = match_helper.get_matched_keys(ret) return acl_tables @@ -52,18 +51,19 @@ def get_port_pbh_binding(db_wrap, port, ns): if not isinstance(db_wrap, Db): raise Exception("db_wrap object is not of type utilities_common.Db") - conn_pool = ConnectionPool() + from dump import match_infra, match_helper + conn_pool = match_infra.ConnectionPool() conn_pool.fill(ns, db_wrap.db_clients[ns], db_wrap.db_list) - m_engine = MatchEngine(conn_pool) - req = MatchRequest(db="CONFIG_DB", - table=PBH, - key_pattern="*", - field="interface_list@", - value=port, - ns=ns, - match_entire_list=False) + m_engine = match_infra.MatchEngine(conn_pool) + req = match_infra.MatchRequest(db="CONFIG_DB", + table=PBH, + key_pattern="*", + field="interface_list@", + value=port, + ns=ns, + match_entire_list=False) ret = m_engine.fetch(req) - pbh_tables, _ = get_matched_keys(ret) + pbh_tables, _ = match_helper.get_matched_keys(ret) return pbh_tables