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

[Mellanox] optimize platform API import time #141

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

from . import utils
from .device_data import DeviceDataManager
from .sfp import SFP, deinitialize_sdk_handle
except ImportError as e:
raise ImportError (str(e) + "- required module not found")

Expand Down Expand Up @@ -113,8 +112,10 @@ def __del__(self):
if self.sfp_event:
self.sfp_event.deinitialize()

if SFP.shared_sdk_handle:
deinitialize_sdk_handle(SFP.shared_sdk_handle)
if self._sfp_list:
from .sfp import SFP, deinitialize_sdk_handle
if SFP.shared_sdk_handle:
deinitialize_sdk_handle(SFP.shared_sdk_handle)

##############################################
# PSU methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import glob
import os
from sonic_py_common import device_info

from . import utils

Expand Down Expand Up @@ -173,6 +172,7 @@ class DeviceDataManager:
@classmethod
@utils.read_only_cache()
def get_platform_name(cls):
from sonic_py_common import device_info
return device_info.get_platform()

@classmethod
Expand Down