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
Copy recordPluginMetrics in CycleState.Clone #108727
Conversation
@sanposhiho: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
Can you also add an UT or add one case in exist UT for it?
/retest |
764f7c1
to
d65ccb0
Compare
/retest |
1 similar comment
/retest |
@Huang-Wei your comment is for #108724, right? |
We only Clone the state when we are doing preemption. I think we don't care about metrics within each sub-step of preemption, as preemption itself has an overall latency metric. |
ah, yes... |
Hmm.. seems we had a bug that the following metrics were never recorded:
as the cloned state always return false on
The impact is on RunPreFilterExtensionAddPod() and RunPreFilterExtensionRemovePod(). I think we should copy the value. See the explanation above. |
Right, but should we record the metrics for Filter/Score that run inside preemption? |
I think so. Actually |
@@ -41,6 +41,7 @@ func TestCycleStateClone(t *testing.T) { | |||
data: data1, | |||
} | |||
state.Write(key, originalValue) | |||
state.SetRecordPluginMetrics(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.
can we test both true and false?
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.
👍
Changed the whole test to be table-driven test and added the test for that as a test case.
d65ccb0
to
55c5d51
Compare
2934df9
to
dee8cb8
Compare
/retest |
|
||
// we need to compare *sync.Map, | ||
// because we cannot define cmp.Comparer for sync.Map or CycleState due to the issue from go vet. | ||
if diff := cmp.Diff(&state.storage, &stateCopy.storage, cmpOpts...); diff != "" { |
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.
Now I think nothing is checking recordPluginMetrics
?
is it a lot of changes if you make CycleState.storage a pointer?
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.
Now I think nothing is checking recordPluginMetrics?
Ah,, right...
if you make CycleState.storage a pointer?
nice idea. No concerns from me.
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.
Fixed.
dee8cb8
to
76a32ea
Compare
/retest |
76a32ea
to
ed58683
Compare
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.
/lgtm
/approve
This can wait for 1.25
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alculquicondor, Huang-Wei, sanposhiho The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I see. #108727 (comment) was based on the old implementation with regular map and mutex, now with sync.map, it seems we need extra work to compare the state. |
c6f312b
to
cadfa7b
Compare
/retest |
cadfa7b
to
ccd6f7a
Compare
/lgtm |
Is it okay to |
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.
/hold cancel
What type of PR is this?
/kind bug
What this PR does / why we need it:
We currently don't copy
recordPluginMetrics
field in CycleState.Clone() sorecordPluginMetrics
in the copied CycleCtate is always false.But if we do so, for example, the following part will always be
false
. Is this the expected behavior..?kubernetes/pkg/scheduler/framework/runtime/framework.go
Line 632 in 1007f49
Ref: #108724 (comment)
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: