Skip to content
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

Remove PodBackoffMap #87948

Merged
merged 1 commit into from
Feb 14, 2020
Merged

Conversation

notpad
Copy link
Contributor

@notpad notpad commented Feb 8, 2020

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind cleanup

What this PR does / why we need it:

The PodBackoffMap don't need to store pod attempts information because PodInfo already contains this data

Which issue(s) this PR fixes:

Fixes #87832

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

None

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


/sig scheduling

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 8, 2020
@notpad
Copy link
Contributor Author

notpad commented Feb 8, 2020

/assign @alculquicondor

@notpad
Copy link
Contributor Author

notpad commented Feb 8, 2020

/retest

4 similar comments
@notpad
Copy link
Contributor Author

notpad commented Feb 8, 2020

/retest

@notpad
Copy link
Contributor Author

notpad commented Feb 8, 2020

/retest

@notpad
Copy link
Contributor Author

notpad commented Feb 9, 2020

/retest

@notpad
Copy link
Contributor Author

notpad commented Feb 9, 2020

/retest

pkg/scheduler/internal/queue/pod_backoff.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/pod_backoff.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/pod_backoff.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/pod_backoff_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/scheduling_queue.go Outdated Show resolved Hide resolved

// Override clock to exceed the DefaultPodInitialBackoffDuration so that unschedulable pods
// will be moved to activeQ
c.SetTime(timestamp.Add(DefaultPodInitialBackoffDuration + 1))
Copy link
Member

Choose a reason for hiding this comment

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

Use c.Step instead.

Copy link
Member

Choose a reason for hiding this comment

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

But we shouldn't be doing this. Is there a clearBackoff related to this that we removed? If so, we should probably also reset Attempts here? @Huang-Wei

pkg/scheduler/internal/queue/pod_backoff.go Outdated Show resolved Hide resolved
maxDuration: maxDuration,
podAttempts: make(map[ktypes.NamespacedName]int),
podLastUpdateTime: make(map[ktypes.NamespacedName]time.Time),
// NewPodBackoff creates a PodBackoff with initial duration and max duration.
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure we need this struct at all, those couple of variables can be part of PriorityQueue, the couple of functions below are pretty short, so they can be methods under PriorityQueue as well

pkg/scheduler/internal/queue/scheduling_queue.go Outdated Show resolved Hide resolved
@notpad
Copy link
Contributor Author

notpad commented Feb 12, 2020

/retest

@alculquicondor
Copy link
Member

Please avoid amending until we have finished reviewing. When you amend, we lose context of the ongoing discussions and we might have to review the whole PR again 😞

@notpad
Copy link
Contributor Author

notpad commented Feb 12, 2020

oh, sorry. I thought the code changed a lot, so I used a force push. Will remember next time.

pkg/scheduler/internal/queue/scheduling_queue_test.go Outdated Show resolved Hide resolved
@@ -1201,6 +1206,22 @@ func TestPendingPodsMetric(t *testing.T) {
}
pInfos = append(pInfos, p)
}
totalWithDelay := 20
var pInfosWithDelay = make([]*framework.PodInfo, 0, totalWithDelay)
Copy link
Member

Choose a reason for hiding this comment

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

instead, you could make the creation of podInfos a function that accepts the current timestamp.

Then, you would have the same steps that you are setting (add, step, add), and some operands like:
pInfos(0, 20), nil, pInfos(20, 30)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but the pInfos will be calculated before the execution of steps (add, step, add),, so it can't get the current timestamp dynamically

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've added a new func to avoid duplicate code

Copy link
Member

@alculquicondor alculquicondor Feb 12, 2020

Choose a reason for hiding this comment

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

well operands could be functions instead of actual values, but this is good enough.

@@ -1589,11 +1607,67 @@ func TestBackOffFlow(t *testing.T) {
}
})
}
// After some time, backoff information is cleared.
cl.Step(time.Hour)
Copy link
Member

Choose a reason for hiding this comment

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

Great to see this going away.

pkg/scheduler/internal/queue/scheduling_queue_test.go Outdated Show resolved Hide resolved
@alculquicondor
Copy link
Member

oh, sorry. I thought the code changed a lot, so I used a force push. Will remember next time.

That's actually fair. No big deal.

@alculquicondor
Copy link
Member

There a few other comments that you haven't addressed. Maybe you missed them because they were added to "resolved" threads?

Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

Resurfacing comments

@@ -380,8 +380,11 @@ func TestPriorityQueue_MoveAllToActiveQueue(t *testing.T) {
addOrUpdateUnschedulablePod(q, q.newPodInfo(&unschedulablePod))
addOrUpdateUnschedulablePod(q, q.newPodInfo(&highPriorityPod))
Copy link
Member

Choose a reason for hiding this comment

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

can we remove addOrUpdateUnschedulablePod?

@alculquicondor
Copy link
Member

/approve

@ahg-g anything to add? If not, we can squash.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, notpad

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 13, 2020
@ahg-g
Copy link
Member

ahg-g commented Feb 13, 2020

/lgtm
/retest

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 13, 2020
@alculquicondor
Copy link
Member

/hold for squash

@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 Feb 13, 2020
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2020
@notpad
Copy link
Contributor Author

notpad commented Feb 14, 2020

/retest

1 similar comment
@notpad
Copy link
Contributor Author

notpad commented Feb 14, 2020

/retest

@alculquicondor
Copy link
Member

/hold cancel

great work @notpad, thanks

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 14, 2020
@alculquicondor
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2020
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@alculquicondor
Copy link
Member

/priority important-longterm

@k8s-ci-robot k8s-ci-robot added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 14, 2020
@k8s-ci-robot k8s-ci-robot merged commit bde718d into kubernetes:master Feb 14, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Feb 14, 2020
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. 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.

Remove PodBackoffMap
6 participants