Skip to content

Change pycommon to use swsscommon #10099

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

Merged

Conversation

liuh-80
Copy link
Contributor

@liuh-80 liuh-80 commented Feb 28, 2022

Why I did it

Switch py-common from swsssdk to swsscommon.

How I did it

Change code and make file to use swsscommon.

How to verify it

Pass all UT and E2E test.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@liuh-80
Copy link
Contributor Author

liuh-80 commented Feb 28, 2022

py_common change will break UT in sonic-platform-daemons, the issue will be fix in this PR: sonic-net/sonic-platform-daemons#246

@lgtm-com
Copy link

lgtm-com bot commented Mar 4, 2022

This pull request introduces 1 alert when merging f21d1c8 into c40f04f - view on LGTM.com

new alerts:

  • 1 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 7, 2022

This pull request introduces 1 alert when merging 45d60b1 into 2ef9d65 - view on LGTM.com

new alerts:

  • 1 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 7, 2022

This pull request introduces 1 alert when merging 5a5f592 into 78e867a - view on LGTM.com

new alerts:

  • 1 for Unused import

@liuh-80
Copy link
Contributor Author

liuh-80 commented Mar 10, 2022

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@liuh-80
Copy link
Contributor Author

liuh-80 commented Mar 10, 2022

This PR is continue of original PR: #7655
And because this PR require many submodule change, for example sonic-utilities change, so this PR will keep in draft status until all change in submodule been merge to master branch, and pass all validation.

@lgtm-com
Copy link

lgtm-com bot commented Mar 10, 2022

This pull request introduces 1 alert when merging 1a3a020 into 8601709 - view on LGTM.com

new alerts:

  • 1 for Unused import

@qiluo-msft
Copy link
Collaborator

qiluo-msft commented Mar 11, 2022

import glob

I notice the filename not proper https://github.com/Azure/sonic-buildimage/blob/8d419ca2c59b0f75c24ba4ed73fbdc7df7812260/src/sonic-py-common/tests/device_info_test.py#L16.

Change mock_swsssdk to mock_swsscommon


In reply to: 1065633693


Refers to: src/sonic-py-common/sonic_py_common/device_info.py:1 in 1a3a020. [](commit_id = 1a3a020, deletion_comment = False)

@liuh-80
Copy link
Contributor Author

liuh-80 commented Mar 14, 2022

import glob

I notice the filename not proper

https://github.com/Azure/sonic-buildimage/blob/8d419ca2c59b0f75c24ba4ed73fbdc7df7812260/src/sonic-py-common/tests/device_info_test.py#L16

.
Change mock_swsssdk to mock_swsscommon

Refers to: src/sonic-py-common/sonic_py_common/device_info.py:1 in 1a3a020. [](commit_id = 1a3a020, deletion_comment = False)

Fixed.

@liuh-80 liuh-80 marked this pull request as ready for review April 18, 2022 07:39
@liuh-80 liuh-80 requested a review from qiluo-msft as a code owner April 18, 2022 07:39
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80
Copy link
Contributor Author

liuh-80 commented May 13, 2022

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80
Copy link
Contributor Author

liuh-80 commented May 16, 2022

After merge with latest master branch code, only 1 UT failed and seems not related with code change in this PR: bgp/test_bgp_update_timer.py

@liuh-80
Copy link
Contributor Author

liuh-80 commented May 18, 2022

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80
Copy link
Contributor Author

liuh-80 commented May 20, 2022

After re-run, still following UT failed:
2022-05-19T00:58:10.3522829Z ERROR bgp/test_bgp_fact.py::test_bgp_facts[128-vlab-02-None] - Failed: Proces...

And same UT failed happened on many other PRs, seems a common issue, will re-run later.

@liuh-80
Copy link
Contributor Author

liuh-80 commented May 20, 2022

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80
Copy link
Contributor Author

liuh-80 commented May 23, 2022

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80
Copy link
Contributor Author

liuh-80 commented May 24, 2022

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -4,6 +4,8 @@ ifeq ($(ENABLE_PY2_MODULES), y)
SONIC_PY_COMMON_PY2 = sonic_py_common-1.0-py2-none-any.whl
$(SONIC_PY_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-common
$(SONIC_PY_COMMON_PY2)_DEPENDS += $(SWSSSDK_PY2)
$(SONIC_PY_COMMON_PY2)_DEBS_DEPENDS = $(LIBSWSSCOMMON) \
Copy link
Collaborator

@qiluo-msft qiluo-msft May 31, 2022

Choose a reason for hiding this comment

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

LIBSWSSCOMMON

Does it depend on LIBSWSSCOMMON directly? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, remove indirect dependency to LIBSWSSCOMMON.

Copy link
Collaborator

Choose a reason for hiding this comment

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

you fixed py3, but py2 still has the same issue.

@liuh-80 liuh-80 requested a review from a team as a code owner June 1, 2022 05:50
@liuh-80 liuh-80 merged commit e4ed475 into sonic-net:master Jun 3, 2022
@vivekrnv
Copy link
Contributor

vivekrnv commented Aug 9, 2022

@liuh-80, @qiluo-msft Can this be backported to 202205? 202205 is still using swsssdk
https://github.com/sonic-net/sonic-buildimage/blob/202205/src/sonic-py-common/sonic_py_common/device_info.py#L11

I've observed some perf difference when running "intfutil -c status".

ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   52    0.003    0.000    1.018    0.020 device_info.py:354(get_platform_info)   (with swsssdk)
   52    0.003    0.000    0.701    0.013 device_info.py:354(get_platform_info)   (with swsscommon)

@dgsudharsan
Copy link
Collaborator

Request for 202205

@qiluo-msft
Copy link
Collaborator

@vivekrnv @dgsudharsan Backport of this feature include many PRs in multiple repos, and with dependencies between them. If there is no strong motivation, we will not backport to 202205 and earlier branches.

@vivekrnv
Copy link
Contributor

vivekrnv commented Aug 16, 2022

@vivekrnv @dgsudharsan Backport of this feature include many PRs in multiple repos, and with dependencies between them. If there is no strong motivation, we will not backport to 202205 and earlier branches.

Thought so looking at the other comments, the only motivation is perf diff, nothing else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants