-
Notifications
You must be signed in to change notification settings - Fork 195
psud: Adding Redis Pipeline for performance improvement #711
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -403,10 +403,11 @@ class DaemonPsud(daemon_base.DaemonBase): | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Connect to STATE_DB and create psu/chassis info tables | ||||||||||||||||||||||||||||||||||||||||||||||||||
| state_db = daemon_base.db_connect("STATE_DB") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.chassis_tbl = swsscommon.Table(state_db, CHASSIS_INFO_TABLE) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.psu_tbl = swsscommon.Table(state_db, PSU_INFO_TABLE) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.fan_tbl = swsscommon.Table(state_db, FAN_INFO_TABLE) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.phy_entity_tbl = swsscommon.Table(state_db, PHYSICAL_ENTITY_INFO_TABLE) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.statedb_redisPipeline = swsscommon.RedisPipeline(state_db, 10) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.chassis_tbl = swsscommon.Table(self.statedb_redisPipeline, CHASSIS_INFO_TABLE, True) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.psu_tbl = swsscommon.Table(self.statedb_redisPipeline, PSU_INFO_TABLE, True) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.fan_tbl = swsscommon.Table(self.statedb_redisPipeline, FAN_INFO_TABLE, True) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.phy_entity_tbl = swsscommon.Table(self.statedb_redisPipeline, PHYSICAL_ENTITY_INFO_TABLE, True) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+407
to
+410
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| self.chassis_tbl = swsscommon.Table(self.statedb_redisPipeline, CHASSIS_INFO_TABLE, True) | |
| self.psu_tbl = swsscommon.Table(self.statedb_redisPipeline, PSU_INFO_TABLE, True) | |
| self.fan_tbl = swsscommon.Table(self.statedb_redisPipeline, FAN_INFO_TABLE, True) | |
| self.phy_entity_tbl = swsscommon.Table(self.statedb_redisPipeline, PHYSICAL_ENTITY_INFO_TABLE, True) | |
| self.chassis_tbl = swsscommon.Table(self.statedb_redisPipeline, CHASSIS_INFO_TABLE) | |
| self.psu_tbl = swsscommon.Table(self.statedb_redisPipeline, PSU_INFO_TABLE) | |
| self.fan_tbl = swsscommon.Table(self.statedb_redisPipeline, FAN_INFO_TABLE) | |
| self.phy_entity_tbl = swsscommon.Table(self.statedb_redisPipeline, PHYSICAL_ENTITY_INFO_TABLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter is needed for the Redis Pipeline implementation and the Table constructor actually does allow these arguments as shown here Table Constructor
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to Table.init with too many arguments; should be no more than 2.
Call to Table.init with too many arguments; should be no more than 2.
Call to Table.init with too many arguments; should be no more than 2.
Call to Table.init with too many arguments; should be no more than 2.
| self.chassis_tbl = swsscommon.Table(self.statedb_redisPipeline, CHASSIS_INFO_TABLE, True) | |
| self.psu_tbl = swsscommon.Table(self.statedb_redisPipeline, PSU_INFO_TABLE, True) | |
| self.fan_tbl = swsscommon.Table(self.statedb_redisPipeline, FAN_INFO_TABLE, True) | |
| self.phy_entity_tbl = swsscommon.Table(self.statedb_redisPipeline, PHYSICAL_ENTITY_INFO_TABLE, True) | |
| self.chassis_tbl = swsscommon.Table(self.statedb_redisPipeline, CHASSIS_INFO_TABLE) | |
| self.psu_tbl = swsscommon.Table(self.statedb_redisPipeline, PSU_INFO_TABLE) | |
| self.fan_tbl = swsscommon.Table(self.statedb_redisPipeline, FAN_INFO_TABLE) | |
| self.phy_entity_tbl = swsscommon.Table(self.statedb_redisPipeline, PHYSICAL_ENTITY_INFO_TABLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter is needed for the Redis Pipeline implementation and the Table constructor actually does allow these arguments as shown here Table Constructor
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to Table.init with too many arguments; should be no more than 2.
Call to Table.init with too many arguments; should be no more than 2.
Call to Table.init with too many arguments; should be no more than 2.
Call to Table.init with too many arguments; should be no more than 2.
| self.chassis_tbl = swsscommon.Table(self.statedb_redisPipeline, CHASSIS_INFO_TABLE, True) | |
| self.psu_tbl = swsscommon.Table(self.statedb_redisPipeline, PSU_INFO_TABLE, True) | |
| self.fan_tbl = swsscommon.Table(self.statedb_redisPipeline, FAN_INFO_TABLE, True) | |
| self.phy_entity_tbl = swsscommon.Table(self.statedb_redisPipeline, PHYSICAL_ENTITY_INFO_TABLE, True) | |
| self.chassis_tbl = swsscommon.Table(self.statedb_redisPipeline, CHASSIS_INFO_TABLE) | |
| self.psu_tbl = swsscommon.Table(self.statedb_redisPipeline, PSU_INFO_TABLE) | |
| self.fan_tbl = swsscommon.Table(self.statedb_redisPipeline, FAN_INFO_TABLE) | |
| self.phy_entity_tbl = swsscommon.Table(self.statedb_redisPipeline, PHYSICAL_ENTITY_INFO_TABLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter is needed for the Redis Pipeline implementation and the Table constructor actually does allow these arguments as shown here Table Constructor
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,9 +103,21 @@ def test_run(self): | |
| daemon_psud.update_psu_data = mock.MagicMock() | ||
| daemon_psud._update_led_color = mock.MagicMock() | ||
| daemon_psud.update_psu_chassis_info = mock.MagicMock() | ||
| daemon_psud.statedb_redisPipeline = mock.MagicMock() | ||
|
|
||
| daemon_psud.run() | ||
| assert daemon_psud.first_run is False | ||
|
Comment on lines
108
to
109
|
||
| daemon_psud.statedb_redisPipeline.flush.assert_called_once() | ||
|
|
||
| # Test Redis pipeline flush exception scenario | ||
| daemon_psud.statedb_redisPipeline.flush.side_effect = Exception("Flush error") | ||
| daemon_psud.log_error = mock.MagicMock() | ||
|
|
||
| result = daemon_psud.run() | ||
| assert result is True | ||
| assert daemon_psud.first_run is False | ||
| daemon_psud.log_error.assert_called_once() | ||
| assert "Exception occurred while flushing Redis pipeline" in daemon_psud.log_error.call_args[0][0] | ||
|
|
||
| def test_update_psu_data(self): | ||
| mock_psu1 = MockPsu("PSU 1", 0, True, True) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to Table.init with too many arguments; should be no more than 2.
Call to Table.init with too many arguments; should be no more than 2.
Call to Table.init with too many arguments; should be no more than 2.
Call to Table.init with too many arguments; should be no more than 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter is needed for the Redis Pipeline implementation and the Table constructor actually does allow these arguments as shown here Table Constructor