refactor: optimize pretest for mult-DUT devices#17493
Merged
yejianquan merged 1 commit intosonic-net:masterfrom Apr 3, 2025
Merged
refactor: optimize pretest for mult-DUT devices#17493yejianquan merged 1 commit intosonic-net:masterfrom
yejianquan merged 1 commit intosonic-net:masterfrom
Conversation
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
bcf2b5b to
eb235f4
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
lolyu
reviewed
Mar 14, 2025
Collaborator
lolyu
left a comment
There was a problem hiding this comment.
do you have data how much faster this PR runs on dualtor/t2 testbed?
tests/test_pretest.py
Outdated
| verify_features_state, dut), "Not all service states are valid!") | ||
| logger.info("The states of features in 'CONFIG_DB' are all valid.") | ||
|
|
||
| with SafeThreadPoolExecutor(max_workers=8) as executor: |
Collaborator
There was a problem hiding this comment.
can we customize the work count based on the duthosts count?
Contributor
Author
There was a problem hiding this comment.
Good question, will verify and update you later
Contributor
Author
There was a problem hiding this comment.
Hey @lolyu, I did some verification and can confirm we have some good improvements on the running time. I have updated the PR description for more details. Please check, thanks!
eb235f4 to
96d3cb1
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
96d3cb1 to
a78af2b
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
a78af2b to
2864bda
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
2864bda to
be9e973
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
yejianquan
added a commit
to Azure/sonic-mgmt.msft
that referenced
this pull request
Jun 4, 2025
… tsa pretest (#344)" (#359) This reverts commit 7551587. I thought we cherry picked the multithreading run of pretest PR (sonic-net/sonic-mgmt#17493) into msft.202405 but we never did, so the PR sonic-net/sonic-mgmt#18699 should never be cherry picked into msft.202405 as it's only a fix when test_pretest.py runs with multithreading. In msft.202405 branch, we are running test_pretest.py (e.g. test_disable_startup_tsa_tsb_service()) in a normal for loop: https://github.com/Azure/sonic-mgmt.msft/blob/202405/tests/test_pretest.py#L385, so we should use duthost instead of dut
opcoder0
pushed a commit
to opcoder0/sonic-mgmt
that referenced
this pull request
Dec 8, 2025
Description of PR Optimize test_pretest.py by Python multithreading to reduce the running time. Summary: Fixes # (issue) Microsoft ADO 30056122 Approach What is the motivation for this PR? We noticed that some test cases in test_pretest.py can be run in parallel with Python multithreading to reduce the running time. After this PR, I will create an internal PR to optimize the test_pretest.py test cases that only exists in our internal repo. How did you do it? How did you verify/test it? I ran the updated code and can confirm it's working well. For dual ToR topo, the running time will be decreased from ~21 min to ~13 min (Elastictest link before the change, Elastictest link after the change) For T2 topo, the running time be decreased from ~46 min to ~18 min (Elastictest link before the change, Elastictest link after the change) co-authorized by: [email protected] Signed-off-by: opcoder0 <[email protected]>
gshemesh2
pushed a commit
to gshemesh2/sonic-mgmt
that referenced
this pull request
Dec 21, 2025
Description of PR Optimize test_pretest.py by Python multithreading to reduce the running time. Summary: Fixes # (issue) Microsoft ADO 30056122 Approach What is the motivation for this PR? We noticed that some test cases in test_pretest.py can be run in parallel with Python multithreading to reduce the running time. After this PR, I will create an internal PR to optimize the test_pretest.py test cases that only exists in our internal repo. How did you do it? How did you verify/test it? I ran the updated code and can confirm it's working well. For dual ToR topo, the running time will be decreased from ~21 min to ~13 min (Elastictest link before the change, Elastictest link after the change) For T2 topo, the running time be decreased from ~46 min to ~18 min (Elastictest link before the change, Elastictest link after the change) co-authorized by: [email protected] Signed-off-by: Guy Shemesh <[email protected]>
gshemesh2
pushed a commit
to gshemesh2/sonic-mgmt
that referenced
this pull request
Jan 26, 2026
Description of PR Optimize test_pretest.py by Python multithreading to reduce the running time. Summary: Fixes # (issue) Microsoft ADO 30056122 Approach What is the motivation for this PR? We noticed that some test cases in test_pretest.py can be run in parallel with Python multithreading to reduce the running time. After this PR, I will create an internal PR to optimize the test_pretest.py test cases that only exists in our internal repo. How did you do it? How did you verify/test it? I ran the updated code and can confirm it's working well. For dual ToR topo, the running time will be decreased from ~21 min to ~13 min (Elastictest link before the change, Elastictest link after the change) For T2 topo, the running time be decreased from ~46 min to ~18 min (Elastictest link before the change, Elastictest link after the change) co-authorized by: [email protected] Signed-off-by: Guy Shemesh <[email protected]>
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 of PR
Optimize
test_pretest.pyby Python multithreading to reduce the running time.Summary:
Fixes # (issue) Microsoft ADO 30056122
Type of change
Back port request
Approach
What is the motivation for this PR?
We noticed that some test cases in
test_pretest.pycan be run in parallel with Python multithreading to reduce the running time.After this PR, I will create an internal PR to optimize the test_pretest.py test cases that only exists in our internal repo.
How did you do it?
How did you verify/test it?
I ran the updated code and can confirm it's working well.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation