Skip to content

Conversation

@gabesaba
Copy link
Contributor

@gabesaba gabesaba commented Oct 3, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

When a workload, in a queue with BestEffortFIFO enabled, has preemption targets, we keep it at the head of the queue until it schedules (or returns inadmissible).

See original proposal here: #6929 (comment)

Which issue(s) this PR fixes:

Fixes #7101, #6929

Special notes for your reviewer:

Let's discuss whether we want to put this behind a feature gate.

Does this PR introduce a user-facing change?

Scheduling: With BestEffortFIFO enabled, we will keep attempting to schedule a workload as long as
it is waiting for preemption targets to complete. This fixes a bugs where an inadmissible
workload went back to head of queue, in front of the preempting workload, allowing
preempted workloads to reschedule

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Oct 3, 2025
@netlify
Copy link

netlify bot commented Oct 3, 2025

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 0ce0aec
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kueue/deploys/68e51747b0f5980008c9a55b

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 3, 2025
@k8s-ci-robot k8s-ci-robot requested a review from kannon92 October 3, 2025 12:38
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gabesaba

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from PBundyra October 3, 2025 12:38
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 3, 2025
@mimowo
Copy link
Contributor

mimowo commented Oct 3, 2025

Please use the release-note block so that the label do-not-merge/release-note-label-needed is removed by the robot

@gabesaba
Copy link
Contributor Author

gabesaba commented Oct 3, 2025

Please use the release-note block so that the label do-not-merge/release-note-label-needed is removed by the robot

I think it was because I had BestEffortFIFO in the middle of the block when I created the PR

/release-note-edit

With BestEffortFIFO enabled, we will keep attempting to schedule a workload as long as
it is waiting for preemption targets to complete. This fixes a bugs where an inadmissible
workload went back to head of queue, in front of the preempting workload, allowing
preempted workloads to reschedule

@k8s-ci-robot
Copy link
Contributor

@gabesaba: /release-note-edit must be used with a single release note block.

In response to this:

Please use the release-note block so that the label do-not-merge/release-note-label-needed is removed by the robot

I think it was because I had BestEffortFIFO in the middle of the block when I created the PR

/release-note-edit

With BestEffortFIFO enabled, we will keep attempting to schedule a workload as long as
it is waiting for preemption targets to complete. This fixes a bugs where an inadmissible
workload went back to head of queue, in front of the preempting workload, allowing
preempted workloads to reschedule

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-sigs/prow repository.

@gabesaba
Copy link
Contributor Author

gabesaba commented Oct 3, 2025

/release-note-edit

With BestEffortFIFO enabled, we will keep attempting to schedule a workload as long as
it is waiting for preemption targets to complete. This fixes a bugs where an inadmissible
workload went back to head of queue, in front of the preempting workload, allowing
preempted workloads to reschedule

@k8s-ci-robot
Copy link
Contributor

@gabesaba: /release-note-edit must be used with a single release note block.

In response to this:

/release-note-edit

With BestEffortFIFO enabled, we will keep attempting to schedule a workload as long as
it is waiting for preemption targets to complete. This fixes a bugs where an inadmissible
workload went back to head of queue, in front of the preempting workload, allowing
preempted workloads to reschedule

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-sigs/prow repository.

@gabesaba
Copy link
Contributor Author

gabesaba commented Oct 3, 2025

/release-note-edit

With BestEffortFIFO enabled, we will keep attempting to schedule a workload as long as it is waiting for preemption targets to complete. This fixes a bugs where an inadmissible workload went back to head of queue, in front of the preempting workload, allowing preempted workloads to reschedule

@k8s-ci-robot
Copy link
Contributor

@gabesaba: /release-note-edit must be used with a single release note block.

In response to this:

/release-note-edit

With BestEffortFIFO enabled, we will keep attempting to schedule a workload as long as it is waiting for preemption targets to complete. This fixes a bugs where an inadmissible workload went back to head of queue, in front of the preempting workload, allowing preempted workloads to reschedule

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Oct 3, 2025
for range 4 {
createWorkload("cq-p1", "2")
}
util.ExpectReservingActiveWorkloadsMetric(cqp1, 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, maybe it is better to use the Admitted metrics as this could sometimes be updated before the quota reservation is fully processed, causing flakes, see: #7155

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@mimowo
Copy link
Contributor

mimowo commented Oct 3, 2025

/lgtm
/cherrypick release-0.14
/cherrypick release-0.13

In case you could fix #7157 (comment). Since this is just a potential issue I'm ok to optimize for fix delivery, feel free to unhold, we could potentially fix in a follow up.
/hold

@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: once the present PR merges, I will cherry-pick it on top of release-0.13, release-0.14 in new PRs and assign them to you.

In response to this:

/lgtm
/cherrypick release-0.14
/cherrypick release-0.13

In case you could fix #7157 (comment). Since this is just a potential issue I'm ok to optimize, feel free to unhold, we could potentially fix in a follow up.
/hold

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 3, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 3, 2025
util.FinishEvictionOfWorkloadsInCQ(ctx, k8sClient, cq2, 2)

ginkgo.By("Expect active workloads")
util.ExpectReservingActiveWorkloadsMetric(cq1, 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried running locally and hit a flake here on the first run:

  [FAILED] Timed out after 10.000s.
  The function passed to Eventually failed at /usr/local/google/home/michalwozniak/go/src/sigs.k8s.io/kueue/test/util/util.go:571 with:
  Expected
      <int>: 0
  to equal
      <int>: 1
  In [It] at: /usr/local/google/home/michalwozniak/go/src/sigs.k8s.io/kueue/test/integration/singlecluster/scheduler/fairsharing/fair_sharing_test.go:898 @ 10/03/25 17:11:51.661

PTAL

Copy link
Contributor

Choose a reason for hiding this comment

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

This flake seems to go away when is addressed: #7157 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran this test 32 times without flakes. I'll try running 128 times now to see if there are any.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, maybe this is fixed by the metric change? I will also test locally with the metric change

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, I tested locally 60 times after the latest changes and no failures, feel free to resolve.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It flaked 3/128 times for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a race condition where the preempted workloads schedule, given that we consider the inadmissible head after deleting the sticky workload

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the test to keep finishing the evictions. It passed 128/128 runs:

gomega.Eventually(func(g gomega.Gomega) {
  util.FinishEvictionsOfAnyWorkloadsInCq(ctx, k8sClient, cq2)
  util.ExpectAdmittedWorkloadsTotalMetric(cq1, "", 1)
  util.ExpectClusterQueueWeightedShareMetric(cq1, 0)
  util.ExpectClusterQueueWeightedShareMetric(cq2, 0)
}, util.Timeout, util.Interval).Should(gomega.Succeed())

@mimowo
Copy link
Contributor

mimowo commented Oct 7, 2025

@mimowo
Copy link
Contributor

mimowo commented Oct 7, 2025

/test pull-kueue-test-integration-extended-main

@mimowo
Copy link
Contributor

mimowo commented Oct 7, 2025

Thank you 👍

/lgtm
/cherrypick release-0.14
/cherrypick release-0.13

@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: once the present PR merges, I will cherry-pick it on top of release-0.13, release-0.14 in new PRs and assign them to you.

In response to this:

Thank you 👍

/lgtm
/cherrypick release-0.14
/cherrypick release-0.13

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 7, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 01585ba9d560c7214e5fd48ab4bfb68291ff7477

@k8s-ci-robot k8s-ci-robot merged commit f8d2887 into kubernetes-sigs:main Oct 7, 2025
23 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.15 milestone Oct 7, 2025
@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: new pull request created: #7197

In response to this:

Thank you 👍

/lgtm
/cherrypick release-0.14
/cherrypick release-0.13

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-sigs/prow repository.

@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: #7157 failed to apply on top of branch "release-0.13":

Applying: Implement Sticky ClusterQueue Head Policy
Using index info to reconstruct a base tree...
A	pkg/cache/queue/cluster_queue.go
M	test/integration/singlecluster/scheduler/fairsharing/fair_sharing_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/integration/singlecluster/scheduler/fairsharing/fair_sharing_test.go
Auto-merging pkg/queue/cluster_queue.go
CONFLICT (content): Merge conflict in pkg/queue/cluster_queue.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Implement Sticky ClusterQueue Head Policy

In response to this:

Thank you 👍

/lgtm
/cherrypick release-0.14
/cherrypick release-0.13

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-sigs/prow repository.

@gabesaba gabesaba deleted the sticky branch October 7, 2025 15:25
@tenzen-y
Copy link
Member

tenzen-y commented Oct 8, 2025

@gabesaba Can you manually open cherry-pick PR to release-0.13?

@gabesaba
Copy link
Contributor Author

gabesaba commented Oct 8, 2025

@gabesaba Can you manually open cherry-pick PR to release-0.13?

Yes. I am waiting for one more PR that I want to cherry-pick at the same time: additional logging for this feature.

@gabesaba gabesaba mentioned this pull request Oct 8, 2025
@tenzen-y
Copy link
Member

tenzen-y commented Oct 8, 2025

@gabesaba Can you manually open cherry-pick PR to release-0.13?

Yes. I am waiting for one more PR that I want to cherry-pick at the same time: additional logging for this feature.

Which PR do you indicate? Has it already merged?

gabesaba added a commit to gabesaba/kueue that referenced this pull request Oct 8, 2025
…s-sigs#7157)

* [BestEffortFIFO] Implement Sticky ClusterQueue Head Policy

* assert using ExpectAdmittedWorkloadsTotalMetric

* FinishEvictionOfAnyWorkloadsInCq method

* fix flakiness; new test case
@mimowo
Copy link
Contributor

mimowo commented Oct 8, 2025

Here: #7201

It will get cherrypicked to 0.14 without conflicts.

We can already start preparing the cherrypick for 0.13 manually, and open the PR for them.

k8s-ci-robot pushed a commit that referenced this pull request Oct 8, 2025
* [BestEffortFIFO] Implement Sticky ClusterQueue Head Policy (#7157)

* [BestEffortFIFO] Implement Sticky ClusterQueue Head Policy

* assert using ExpectAdmittedWorkloadsTotalMetric

* FinishEvictionOfAnyWorkloadsInCq method

* fix flakiness; new test case

* logging for 7157
@mimowo
Copy link
Contributor

mimowo commented Nov 28, 2025

/release-note-edit

Scheduling: With BestEffortFIFO enabled, we will keep attempting to schedule a workload as long as
it is waiting for preemption targets to complete. This fixes a bugs where an inadmissible
workload went back to head of queue, in front of the preempting workload, allowing
preempted workloads to reschedule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

preemption bug with LessThanOrEqualToFinalShare and infinite preemption, v0.13.5

8 participants