Optimise queries to save Blocked Device Info in Repository#683
Merged
Conversation
…rsistence and fixed formatting error in HydraLabClientUtils
…where we need to make the isAllOffline to false before checing for blocked device in runTestTaskByGroup method.
…into user/ujsrivastava/optimise_sql_query
|
Please take me off the mailing list.
…On Tue, Mar 11, 2025 at 11:15 PM Ujjwal Srivastava ***@***.***> wrote:
Description Linked GitHub issue ID: Pull Request Checklist
- Tests for the changes have been added (for bug fixes / features)
- Code compiles correctly with all tests are passed.
- I've read the contributing guide
<https://github.com/microsoft/HydraLab/blob/main/CONTRIBUTING.md#making-changes-to-the-code>
and followed the recommended practices.
- Wikis <https://github.com/microsoft/HydraLab/wiki> or README
<https://github.com/microsoft/HydraLab/blob/main/README.md> have been
reviewed and added / updated if needed (for bug fixes / features)
Does this introduce a breaking change?
*If this introduces a breaking change for Hydra Lab users, please describe
the impact and migration path.*
- Yes
- No
How you tested it
*Please make sure the change is tested, you can test it by adding UTs, do
local test and share the screenshots, etc.*
Please check the type of change your PR introduces:
- Bugfix
- Feature
- Technical design
- Build related changes
- Refactoring (no functional changes, no api changes)
- Code style update (formatting, renaming) or Documentation content
changes
- Other (please describe):
Feature UI screenshots or Technical design diagrams
*If this is a relatively large or complex change, kick it off by drawing
the tech design with PlantUML and explaining why you chose the solution you
did and what alternatives you considered, etc...*
------------------------------
You can view, comment on, or merge this pull request online at:
#683
Commit Summary
- 85ae41b
<85ae41b>
Save Blocked Device Information in BlockedDeviceInfoRepository for
persistence and fixed formatting error in HydraLabClientUtils
- b2548fa
<b2548fa>
modified DB operation to predefined CRUD operations and fix an issue where
we need to make the isAllOffline to false before checing for blocked device
in runTestTaskByGroup method.
- 5851924
<5851924>
changed method to access database entries and added test
- a02c3ef
<a02c3ef>
optimized query
- 3cee3a5
<3cee3a5>
Merge branch 'user/ujsivastava/save_blocked_device_info_in_database' into
user/ujsrivastava/optimise_sql_query
File Changes
(3 files <https://github.com/microsoft/HydraLab/pull/683/files>)
- *M*
center/src/main/java/com/microsoft/hydralab/center/service/DeviceAgentManagementService.java
<https://github.com/microsoft/HydraLab/pull/683/files#diff-289317ad410c52c217b55f97dc31f0806ffad3b4cc737a56e255701ad77f3797>
(42)
- *M*
center/src/test/java/com/microsoft/hydralab/center/service/DeviceAgentManagementServiceTest.java
<https://github.com/microsoft/HydraLab/pull/683/files#diff-6562c25d5fc53e481385e45d6835f0017d51ca06bcbe2a6bdbee489a0c15e51c>
(9)
- *M*
common/src/main/java/com/microsoft/hydralab/common/repository/BlockedDeviceInfoRepository.java
<https://github.com/microsoft/HydraLab/pull/683/files#diff-f76c5b6f6c8de8f14263d4913754c060bd181a96e20e8aeff3728fd254a9e15a>
(16)
Patch Links:
- https://github.com/microsoft/HydraLab/pull/683.patch
- https://github.com/microsoft/HydraLab/pull/683.diff
—
Reply to this email directly, view it on GitHub
<#683>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANPYUCXKK6UFSLDCA4XCK32T7GI5AVCNFSM6AAAAABY2V4YMKVHI2DSMVQWIX3LMV43ASLTON2WKOZSHEYTEOBRHE2DCNY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
zhou9584
approved these changes
Mar 12, 2025
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request includes several changes to the
DeviceAgentManagementServiceand its related repository to improve the handling of blocked devices. The most important changes involve replacing direct repository calls withOptionalchecks, consolidating delete operations, and simplifying imports.Improvements to blocked device handling:
center/src/main/java/com/microsoft/hydralab/center/service/DeviceAgentManagementService.java: Replaced direct repository calls withOptionalchecks to handle the presence of blocked devices more safely.center/src/main/java/com/microsoft/hydralab/center/service/DeviceAgentManagementService.java: Simplified theunBlockDevicemethod by consolidating delete operations into a single repository methoddeleteIfExists.Repository improvements:
common/src/main/java/com/microsoft/hydralab/common/repository/BlockedDeviceInfoRepository.java: AddedOptionalreturn type forfindByBlockedDeviceSerialNumberand consolidated delete operations into a new methoddeleteIfExists.Codebase simplification:
center/src/test/java/com/microsoft/hydralab/center/service/DeviceAgentManagementServiceTest.java: Updated test cases to use the newdeleteIfExistsmethod.Linked GitHub issue ID:
#685
Pull Request Checklist
Does this introduce a breaking change?
If this introduces a breaking change for Hydra Lab users, please describe the impact and migration path.
How you tested it
Please make sure the change is tested, you can test it by adding UTs, do local test and share the screenshots, etc.
Yes , tested it multiple times by blocking and unblocking devices and using unit tests.
Blocking a device

Unblocking a device

Please check the type of change your PR introduces:
Feature UI screenshots or Technical design diagrams
If this is a relatively large or complex change, kick it off by drawing the tech design with PlantUML and explaining why you chose the solution you did and what alternatives you considered, etc...