Commit Graph

314 Commits (b15b18f932dab891f4e5c11ea0d61135e47d46ab)

Author SHA1 Message Date
Silvery Fu 8792f99bf8 Fix the handling of untagged images 2018-06-04 13:57:09 -07:00
Silvery Fu 73970a5027 Update generated bazel 2018-06-04 13:56:51 -07:00
Łukasz Osipiuk 98041d0925 Allow parametrization of RequestedToCapacityRatio priority function via policy config 2018-06-04 12:28:54 +02:00
Łukasz Osipiuk 4684d5aac6 Register RequestedToCapacityRatioPriority priority function 2018-06-04 11:30:57 +02:00
Hemant Kumar a0a9ccfa87 Implement scheduler changes for volume limits 2018-06-01 19:17:31 -04:00
Guoliang Wang 761cf41427 Move pkg/scheduler/schedulercache -> pkg/scheduler/cache 2018-05-31 22:55:34 +08:00
Kubernetes Submit Queue b5d21a92ad
Merge pull request #64339 from liztio/pronouns
Automatic merge from submit-queue (batch tested with PRs 61803, 64305, 64170, 64361, 64339). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove some unnecessarily gendered pronouns in comments

**What this PR does / why we need it**:

A bunch of comments are unnecessarily gendered. I've changed them to gender-neutral they/theirs.

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-30 17:34:25 -07:00
Krzysztof Siedlecki 0e833bfc83 Fixing scheduling latency metrics 2018-05-30 11:20:12 +02:00
Kubernetes Submit Queue d057795f3b
Merge pull request #64278 from silveryfu/master
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Adding tests for ImageLocalityPriority

**What this PR does / why we need it**:

This PR adds tests for ImageLocalityPriority scheduling policy, as follow-ups of [#63842](https://github.com/kubernetes/kubernetes/issues/63842) and [#63345](https://github.com/kubernetes/kubernetes/issues/63345). It includes the unit test for ImageSizes function of NodeInfo in the scheduler cache.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

@resouer 

**Release note**:

```release-note
NONE
```
2018-05-26 12:46:57 -07:00
liz ffeca16101
Remove some unnecessarily gendered pronouns in comments 2018-05-25 17:48:17 -04:00
Kubernetes Submit Queue 8b442973ac
Merge pull request #64302 from krmayankk/refactor-rbd
Automatic merge from submit-queue (batch tested with PRs 64204, 64302). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

simplify logic and remove else blocks

```release-note
NONE
```
2018-05-25 05:47:07 -07:00
Kubernetes Submit Queue 89b73711fe
Merge pull request #64049 from aveshagarwal/master-scheduler-flake
Automatic merge from submit-queue (batch tested with PRs 61963, 64279, 64130, 64125, 64049). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix TestSchedulerWithVolumeBinding to avoid setting predicate ordering.

It is causing data race condition as predicate ordering is changing global
variable `predicatesOrdering`. Infact this test does not require any special
predicate order and should work on default predicate ordering as far as
VolumeScheduling feature is enabled.

See these logs:

```
==================
==================
WARNING: DATA RACE
Read at 0x00c420894180 by goroutine 156:
  k8s.io/kubernetes/pkg/scheduler/core.podFitsOnNode()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/core/generic_scheduler.go:503 +0xbb
  k8s.io/kubernetes/pkg/scheduler/core.(*genericScheduler).findNodesThatFit.func1()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/core/generic_scheduler.go:353 +0x2f0
  k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue.Parallelize.func1()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue/parallelizer.go:47 +0xa3

Previous write at 0x00c420894180 by goroutine 186:
  k8s.io/kubernetes/pkg/scheduler.TestSchedulerWithVolumeBinding()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/scheduler_test.go:663 +0x71
  testing.tRunner()
      /usr/lib/golang/src/testing/testing.go:777 +0x16d

Goroutine 156 (running) created at:
  k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue.Parallelize()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue/parallelizer.go:43 +0x139
  k8s.io/kubernetes/pkg/scheduler/core.(*genericScheduler).findNodesThatFit()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/core/generic_scheduler.go:378 +0xe8a
  k8s.io/kubernetes/pkg/scheduler/core.(*genericScheduler).Schedule()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/core/generic_scheduler.go:131 +0x385
  k8s.io/kubernetes/pkg/scheduler.(*Scheduler).schedule()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/scheduler.go:192 +0xcd
  k8s.io/kubernetes/pkg/scheduler.(*Scheduler).scheduleOne()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/scheduler.go:447 +0x598
  k8s.io/kubernetes/pkg/scheduler.(*Scheduler).(k8s.io/kubernetes/pkg/scheduler.scheduleOne)-fm()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/scheduler.go:182 +0x41
  k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133 +0x61
  k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134 +0xcd
  k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait.Until()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88 +0x5a

Goroutine 186 (running) created at:
  testing.(*T).Run()
      /usr/lib/golang/src/testing/testing.go:824 +0x564
  testing.runTests.func1()
      /usr/lib/golang/src/testing/testing.go:1063 +0xa4
  testing.tRunner()
      /usr/lib/golang/src/testing/testing.go:777 +0x16d
  testing.runTests()
      /usr/lib/golang/src/testing/testing.go:1061 +0x4e1
  testing.(*M).Run()
      /usr/lib/golang/src/testing/testing.go:978 +0x2cd
  main.main()
      _testmain.go:52 +0x22a
==================
--- FAIL: TestSchedulerWithVolumeBinding (18.04s)
	testing.go:730: race detected during execution of test
FAIL
```

It is pretty easy to reproduce this race by following these steps:

```
cd pkg/scheduler
go test -c -race
stress -p 100 ./scheduler.test
```

Predicate ordering to this unit test was added here: https://github.com/kubernetes/kubernetes/pull/57168
Since the whole scheduler instance uses just one ordering at time, not sure what is the advantage. 

@kubernetes/sig-scheduling-bugs @bsalamat @k82cn @frobware @smarterclayton @sjenning 

```release-note
None
```
2018-05-25 01:09:29 -07:00
Mayank Kumar 83818ee0c8 simplify else 2018-05-25 00:38:54 -07:00
Silvery Fu 096dda3768 Rename and add unit test for ImageSizes 2018-05-24 23:29:23 -07:00
Kubernetes Submit Queue b8dff0b4f1
Merge pull request #63975 from godliness/lock-optimization
Automatic merge from submit-queue (batch tested with PRs 63434, 64172, 63975, 64180, 63755). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Optimize the lock which in the RunPredicate

**What this PR does / why we need it**:


Enhance the performance of scheduler

-  Change the lock in the RunPredicate from lock to rlock




**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

Could solve part of #63784 

**Special notes for your reviewer**:

_Run benchmark test by scheduler_perf_:
`Before`  BenchmarkScheduling/1000Nodes/0Pods-32     1000    11689758 ns/op
`After`     BenchmarkScheduling/1000Nodes/0Pods-32     1000    5951510 ns/op

_Run integration (density) test by scheduler_perf_:
Schedule 3000 Pods On 3000 Nodes
`Before`  rate  19 per second on average
`After`     rate  58 per second on average

_Cpu profile test result_:
`Before`  [click](https://cdn.rawgit.com/godliness/files/master/63784_before.svg)
`After`     [click](https://cdn.rawgit.com/godliness/files/master/63784_after.svg)

**Release note**:

```release-note
`None`
```

/sig scheduling

/cc @misterikkit 
/cc @bsalamat
/cc @ravisantoshgudimetla 
/cc @resouer
2018-05-24 12:18:17 -07:00
Kubernetes Submit Queue a80b334bcb
Merge pull request #63895 from misterikkit/warning-note
Automatic merge from submit-queue (batch tested with PRs 64127, 63895, 64066, 64215, 64202). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add warnings about cache invalidation.

Part of https://github.com/kubernetes/kubernetes/pull/63040 is the
assumption that scheduler cache updates must happen before equivalence
cache updates for any given informer event.

The reason for this is that the equivalence cache implementation checks
the main cache for staleness while holding the equiv. cache write lock.

case 1: If an informer invalidates an equiv. cache entry before the
staleness check, then we know that the main cache update completed.

case 2: If an informer blocks trying to grab the equiv. cache lock, then
invalidation will occur right after the potentially stale update is
written.

This patch adds a note to places where we invalidate the equivalence
cache so that hopefully nobody violates this invariant.



**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
/kind cleanup
/sig scheduling
2018-05-24 10:45:15 -07:00
Kubernetes Submit Queue 2a18b02641
Merge pull request #64216 from misterikkit/nil-or-empty
Automatic merge from submit-queue (batch tested with PRs 64174, 64187, 64216, 63265, 64223). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Do not use DeepEqual to compare slices in test.

This wraps DeepEqual with a helper that considers nil slices and empty
slices to be equal.

Scheduler code might use a nil slice or empty slice to represent an
empty list, so tests should not be sensitive to the difference.  Tests
could fail because DeepEqual considers nil to be different from an empty
slice.



**What this PR does / why we need it**:
Avoid breaking tests in cases where application behavior is not changed.

**Special notes for your reviewer**:
This brittle test keeps breaking in a number of my PRs. Hoping to get this fix merged independently.

**Release note**:

```release-note
NONE
```

/sig scheduling
/kind cleanup
2018-05-24 09:41:17 -07:00
godliness 506271b363 Optimize the lock which in the RunPredicate 2018-05-24 10:41:19 +08:00
Jonathan Basseri 2de996856f Do not use DeepEqual to compare slices in test.
This wraps DeepEqual with a helper that considers nil slices and empty
slices to be equal.

Scheduler code might use a nil slice or empty slice to represent an
empty list, so tests should not be sensitive to the difference.  Tests
could fail because DeepEqual considers nil to be different from an empty
slice.
2018-05-23 11:18:00 -07:00
Kubernetes Submit Queue c0f1cb67e3
Merge pull request #64032 from wgliang/master.rmove-scheduler-unused
Automatic merge from submit-queue (batch tested with PRs 63283, 64032, 64159, 64126, 64098). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove unused code of (pkg/scheduler)

**What this PR does / why we need it**:
/kind cleanup

remove unused code


**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-22 22:14:07 -07:00
Jonathan Basseri 18a8184dce Add warnings about cache invalidation.
Part of https://github.com/kubernetes/kubernetes/pull/63040 is the
assumption that scheduler cache updates must happen before equivalence
cache updates for any given informer event.

The reason for this is that the equivalence cache implementation checks
the main cache for staleness while holding the equiv. cache write lock.

case 1: If an informer invalidates an equiv. cache entry before the
staleness check, then we know that the main cache update completed.

case 2: If an informer blocks trying to grab the equiv. cache lock, then
invalidation will occur right after the potentially stale update is
written.

This patch adds a note to places where we invalidate the equivalence
cache so that hopefully nobody violates this invariant.
2018-05-22 15:15:37 -07:00
Kubernetes Submit Queue 0a2467d849
Merge pull request #63459 from resouer/fix-63427
Automatic merge from submit-queue (batch tested with PRs 63598, 63913, 63459, 63963, 60464). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Check nodeInfo before ecache predicate

**What this PR does / why we need it**:

There's chances during test when nodeInfo is nil which may cause ecache predicate fail with nil pointer.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63427

**Special notes for your reviewer**:

Not sure how to reproduce the original issue yet. i.e. why and when `nodeInfo` will become nil in tests is not clear to me, that's why I label it as WIP.

cc @bsalamat who may have more inputs.

**Release note**:

```release-note
NONE
```
2018-05-19 06:49:19 -07:00
Avesh Agarwal ea057eb9b5 Fix TestSchedulerWithVolumeBinding to avoid setting predicate ordering.
It is causing data race condition as predicate ordering is changing global
variable predicatesOrdering. Infact this test does not require any special
predicate order and should work on default predicate ordering as far as
VolumeScheduling feature is enabled.
2018-05-18 14:19:26 -04:00
Guoliang Wang 9219a76266 remove unused code of (pkg/scheduler) 2018-05-18 23:48:43 +08:00
Kubernetes Submit Queue 9a15ee7035
Merge pull request #63749 from wenlxie/githubupstream.master.minofixforgetstorageclass
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

minor fix for VolumeZoneChecker predicate 

storageclass can be in annotation and spec.

```release-note
minor fix for VolumeZoneChecker predicate, storageclass can be in annotation and spec.
```
2018-05-17 05:51:05 -07:00
wenlxie 38106e7f0b storageclass can be in annotation and spec 2018-05-16 20:49:09 +08:00
Kubernetes Submit Queue af9531b8a7
Merge pull request #63658 from xchapter7x/pkg-scheduler-algorithm-priorities
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use subtest for table units (pkg-scheduler-algorithm-priorities)

**What this PR does / why we need it**: Update scheduler's unit table tests to use subtest

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

**Special notes for your reviewer**:
breaks up PR: https://github.com/kubernetes/kubernetes/pull/63281
/ref #63267

**Release note**:

```release-note
This PR will leverage subtests on the existing table tests for the scheduler units.
Some refactoring of error/status messages and functions to align with new approach.

```
2018-05-15 14:12:39 -07:00
Kubernetes Submit Queue c4994e17d6
Merge pull request #63603 from resouer/clean-cache
Automatic merge from submit-queue (batch tested with PRs 63603, 63557, 62015). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Clean up equiv cache with a simple implementation instead of LRU

**What this PR does / why we need it**:

The original version of equiv cache use pod hash as cache key, also, the predicate order is not fixed. So I used a LRU cache to improve hit rate.

While now we've already refactored it to use predicates as keys, and its order was also fixed in scheduler, we can use a simplest cache instead now.

**Special notes for your reviewer**:

The question is brought up by @misterikkit

**Release note**:

```release-note
NONE
```
2018-05-15 02:07:38 -07:00
Harry Zhang 7f01ce4ec0 Update generated bazel 2018-05-11 14:25:23 +08:00
Harry Zhang 0377c69aad Use simple cache instead of LRU
Update generated bazel

Use map instead
2018-05-11 14:25:17 +08:00
John Calabrese 3a9e988015 use subtest for table units 2018-05-10 07:12:20 -04:00
Kubernetes Submit Queue aea6addb82
Merge pull request #62934 from wackxu/scto
Automatic merge from submit-queue (batch tested with PRs 62354, 62934, 63502). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Refactor GetResourceRequest and GetResourceLimit

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:
/assign @bsalamat 

**Release note**:

```release-note
NONE
```
2018-05-09 09:30:11 -07:00
Kubernetes Submit Queue 0949cefd7b
Merge pull request #62453 from k82cn/k8s_61410_2
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Supported nodeSelector.matchFields in scheduler.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
part of  #61410

**Special notes for your reviewer**:

**Release note**:
```release-note
Supported nodeSelector.matchFields (node's `metadata.node`) in scheduler.
```
2018-05-09 02:47:21 -07:00
wackxu adea3733a8 add SetMaxResource for Resource 2018-05-09 15:33:24 +08:00
Kubernetes Submit Queue 13f3c7c7ca
Merge pull request #63120 from wgliang/master.remove-todo
Automatic merge from submit-queue (batch tested with PRs 58580, 63120). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

-Remove TODO comment of GetNonzeroRequests function

**What this PR does / why we need it**:

-Remove TODO comment of GetNonzeroRequests function

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
NONE

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-08 21:45:13 -07:00
Silvery Fu 4087ff32bc Build image size map upon node info updates 2018-05-08 15:02:18 -07:00
Kubernetes Submit Queue 8d064823bb
Merge pull request #63264 from bsalamat/monotonic_generation
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Increase scheduler cache generation number monotonically in order to avoid collision

**What this PR does / why we need it**:
Increments the scheduler cache generation number monotonically to avoid collision of the generation numbers. More context in #63262.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63262.

**Special notes for your reviewer**:

**Release note**:

```release-note
Increase scheduler cache generation number monotonically in order to avoid collision and use of stale information in scheduler.
```
2018-05-08 03:45:57 -07:00
Harry Zhang 8df3ab75a4 Check nodeInfo before ecache 2018-05-06 22:42:20 +08:00
David Eads 94e3d94d67 update tests to be specific about the versions they are testing instead of floating 2018-05-01 13:18:41 -04:00
Kubernetes Submit Queue 12a6236148
Merge pull request #63178 from misterikkit/ecache-locking
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

scheduler: clean up and simplify equivalence cache locking

**What this PR does / why we need it**:
This is a cleanup of the locking code for equivalence cache. There is no change to the current logic or locking. This PR has a couple of implications, though.
1. It deletes (unreachable) code that could have been used to cache predicate results that consider nominated pods.
2. Callers should no longer lock/unlock the eCache manually, so coordinating that lock with other synchronization is restricted.


**Special notes for your reviewer**:

**Release note**:
<!--  Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
action required".
2. If no release note is required, just write "NONE".
-->
```release-note
NONE
```
/sig scheduling
/kind cleanup
2018-04-30 19:29:49 -07:00
ceshihao 7f24a7c984 run make update 2018-04-28 15:43:09 +00:00
Da K. Ma b1a7f85c9e Supported matchField for NodeAffinity.
Signed-off-by: Da K. Ma <klaus1982.cn@gmail.com>
2018-04-28 11:10:29 +08:00
ceshihao 56b3f2f409 move pkg/scheduler/util/testutil.go to pkg/scheduler/testing 2018-04-28 02:36:04 +00:00
Bobby (Babak) Salamat 3cfed68c7a fixup! Make scheduler cache generation number monotonic to avoid collision 2018-04-27 17:52:02 -07:00
Jonathan Basseri 79d30b1ad6 Hide EquivalenceCache mutex from users.
Since the equiv. cache lock no longer needs to be held across multiple
method calls, move the locking inside and don't expose it to users.
2018-04-27 15:55:10 -07:00
Jonathan Basseri b85184227d Rename exported methods on EquivalenceCache.
This changes two methods in EquivalenceCache to be unexported, because
they should no longer be called by users of this type. (Even users in
the same package!)
2018-04-27 15:55:10 -07:00
Jonathan Basseri 55662f26f1 Simplify logic in podFitsOnNode.
Use new (*EquivalenceCache).RunPredicate to simplify how we read and
update the equivalence cache items.
2018-04-27 15:55:10 -07:00
Jonathan Basseri e67b3225a4 Remove predicateResults map from podFitsOnNode.
The purpose of this map is to combine two predicate results before
writing to the equivalence cache. However, the branch that combines
results is unreachable.

1. Combining results happens in the second iteration of the outer loop.
2. There is only a second iteration when podsAdded is true.
3. We skip equiv. cache when podsAdded is true.
2018-04-27 15:55:10 -07:00
Jonathan Basseri ca6b312c97 Add RunPredicate to EquivalenceCache.
This method combines "lookup" and "update" into one operation. The
benefit is that this method call is very similar to running an ordinary
predicate, so callers can simplify their code.
2018-04-27 15:55:10 -07:00
Bobby (Babak) Salamat b90892fa95 Make scheduler cache generation number monotonic to avoid collision 2018-04-27 13:23:25 -07:00