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

[ycabled] move swsscommon API's from subroutines to call them exactly once per task_worker/thread #303

Merged
merged 22 commits into from
Nov 7, 2022

Conversation

vdahiya12
Copy link
Contributor

@vdahiya12 vdahiya12 commented Oct 6, 2022

This PR attempts for ycabled to have all
swsscommon.Table and daemon_base.db_connect
as just a single call in the thread instance for all task_workers

For example all swsscommon calls to open Tables are moved as class object varables, which are reused when needed instead of opening the Table again in subroutines.

self.config_db[asic_id] = daemon_base.db_connect("CONFIG_DB", namespace)

This would help in avoiding unforeseen redis-errors
Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com

Description

Motivation and Context

How Has This Been Tested?

Deploying changes on testbed and UT

Additional Information (Optional)

once

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Copy link
Collaborator

@prgeor prgeor left a comment

Choose a reason for hiding this comment

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

please take care of comments

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@vdahiya12 vdahiya12 changed the title [ycabled] move swsscommon calls from subroutines to call them exactly [ycabled] move swsscommon API's from subroutines to call them exactly once per task_worker/thread Oct 10, 2022
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Oct 11, 2022

This pull request introduces 1 alert when merging 3924d75 into 23b6970 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@vdahiya12 vdahiya12 requested a review from zjswhhh October 12, 2022 20:32
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
zjswhhh
zjswhhh previously approved these changes Oct 12, 2022
sonic-ycabled/ycable/ycable.py Outdated Show resolved Hide resolved
sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py Outdated Show resolved Hide resolved
@zjswhhh zjswhhh requested a review from prgeor October 13, 2022 20:18
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Oct 24, 2022

This pull request introduces 2 alerts when merging 7556185 into 4ea12cf - view on LGTM.com

new alerts:

  • 2 for Unused local variable

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Oct 24, 2022

This pull request introduces 2 alerts when merging ac2888d into 4ea12cf - view on LGTM.com

new alerts:

  • 2 for Unused local variable

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Oct 24, 2022

This pull request introduces 2 alerts when merging 717e599 into 4ea12cf - view on LGTM.com

new alerts:

  • 2 for Unused local variable

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
prgeor
prgeor previously approved these changes Oct 30, 2022
@prgeor prgeor added the Y-Cable label Oct 30, 2022
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@vdahiya12 vdahiya12 merged commit 905874d into sonic-net:master Nov 7, 2022
@vdahiya12
Copy link
Contributor Author

#310 added in 202012

yxieca pushed a commit that referenced this pull request Nov 29, 2022
… once per task_worker/thread (#303)

This PR attempts for ycabled to have all
swsscommon.Table and daemon_base.db_connect
as just a single call in the thread instance for all task_workers

For example all swsscommon calls to open Tables are moved as class object varables, which are reused when needed instead of opening the Table again in subroutines.

self.config_db[asic_id] = daemon_base.db_connect("CONFIG_DB", namespace)
This would help in avoiding unforeseen redis-errors
Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com

Description
Motivation and Context
How Has This Been Tested?
Deploying changes on testbed and UT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants