Browse Source

Vendor swarmkit 1f3e4e6

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Aaron Lehmann 8 years ago
parent
commit
bef21471d7

+ 1 - 1
vendor.conf

@@ -101,7 +101,7 @@ github.com/docker/containerd aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
 github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4
 github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4
 
 
 # cluster
 # cluster
-github.com/docker/swarmkit 30a4278953316a0abd88d35c8d6600ff5add2733
+github.com/docker/swarmkit 1f3e4e67eeac60456460a270179711d0808129f9
 github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
 github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
 github.com/gogo/protobuf v0.3
 github.com/gogo/protobuf v0.3
 github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a
 github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a

+ 19 - 19
vendor/github.com/docker/swarmkit/manager/scheduler/nodeinfo.go

@@ -11,10 +11,10 @@ import (
 // NodeInfo contains a node and some additional metadata.
 // NodeInfo contains a node and some additional metadata.
 type NodeInfo struct {
 type NodeInfo struct {
 	*api.Node
 	*api.Node
-	Tasks                             map[string]*api.Task
-	DesiredRunningTasksCount          int
-	DesiredRunningTasksCountByService map[string]int
-	AvailableResources                api.Resources
+	Tasks                     map[string]*api.Task
+	ActiveTasksCount          int
+	ActiveTasksCountByService map[string]int
+	AvailableResources        api.Resources
 
 
 	// recentFailures is a map from service ID to the timestamps of the
 	// recentFailures is a map from service ID to the timestamps of the
 	// most recent failures the node has experienced from replicas of that
 	// most recent failures the node has experienced from replicas of that
@@ -28,9 +28,9 @@ func newNodeInfo(n *api.Node, tasks map[string]*api.Task, availableResources api
 	nodeInfo := NodeInfo{
 	nodeInfo := NodeInfo{
 		Node:  n,
 		Node:  n,
 		Tasks: make(map[string]*api.Task),
 		Tasks: make(map[string]*api.Task),
-		DesiredRunningTasksCountByService: make(map[string]int),
-		AvailableResources:                availableResources,
-		recentFailures:                    make(map[string][]time.Time),
+		ActiveTasksCountByService: make(map[string]int),
+		AvailableResources:        availableResources,
+		recentFailures:            make(map[string][]time.Time),
 	}
 	}
 
 
 	for _, t := range tasks {
 	for _, t := range tasks {
@@ -48,9 +48,9 @@ func (nodeInfo *NodeInfo) removeTask(t *api.Task) bool {
 	}
 	}
 
 
 	delete(nodeInfo.Tasks, t.ID)
 	delete(nodeInfo.Tasks, t.ID)
-	if oldTask.DesiredState == api.TaskStateRunning {
-		nodeInfo.DesiredRunningTasksCount--
-		nodeInfo.DesiredRunningTasksCountByService[t.ServiceID]--
+	if oldTask.DesiredState <= api.TaskStateRunning {
+		nodeInfo.ActiveTasksCount--
+		nodeInfo.ActiveTasksCountByService[t.ServiceID]--
 	}
 	}
 
 
 	reservations := taskReservations(t.Spec)
 	reservations := taskReservations(t.Spec)
@@ -65,15 +65,15 @@ func (nodeInfo *NodeInfo) removeTask(t *api.Task) bool {
 func (nodeInfo *NodeInfo) addTask(t *api.Task) bool {
 func (nodeInfo *NodeInfo) addTask(t *api.Task) bool {
 	oldTask, ok := nodeInfo.Tasks[t.ID]
 	oldTask, ok := nodeInfo.Tasks[t.ID]
 	if ok {
 	if ok {
-		if t.DesiredState == api.TaskStateRunning && oldTask.DesiredState != api.TaskStateRunning {
+		if t.DesiredState <= api.TaskStateRunning && oldTask.DesiredState > api.TaskStateRunning {
 			nodeInfo.Tasks[t.ID] = t
 			nodeInfo.Tasks[t.ID] = t
-			nodeInfo.DesiredRunningTasksCount++
-			nodeInfo.DesiredRunningTasksCountByService[t.ServiceID]++
+			nodeInfo.ActiveTasksCount++
+			nodeInfo.ActiveTasksCountByService[t.ServiceID]++
 			return true
 			return true
-		} else if t.DesiredState != api.TaskStateRunning && oldTask.DesiredState == api.TaskStateRunning {
+		} else if t.DesiredState > api.TaskStateRunning && oldTask.DesiredState <= api.TaskStateRunning {
 			nodeInfo.Tasks[t.ID] = t
 			nodeInfo.Tasks[t.ID] = t
-			nodeInfo.DesiredRunningTasksCount--
-			nodeInfo.DesiredRunningTasksCountByService[t.ServiceID]--
+			nodeInfo.ActiveTasksCount--
+			nodeInfo.ActiveTasksCountByService[t.ServiceID]--
 			return true
 			return true
 		}
 		}
 		return false
 		return false
@@ -84,9 +84,9 @@ func (nodeInfo *NodeInfo) addTask(t *api.Task) bool {
 	nodeInfo.AvailableResources.MemoryBytes -= reservations.MemoryBytes
 	nodeInfo.AvailableResources.MemoryBytes -= reservations.MemoryBytes
 	nodeInfo.AvailableResources.NanoCPUs -= reservations.NanoCPUs
 	nodeInfo.AvailableResources.NanoCPUs -= reservations.NanoCPUs
 
 
-	if t.DesiredState == api.TaskStateRunning {
-		nodeInfo.DesiredRunningTasksCount++
-		nodeInfo.DesiredRunningTasksCountByService[t.ServiceID]++
+	if t.DesiredState <= api.TaskStateRunning {
+		nodeInfo.ActiveTasksCount++
+		nodeInfo.ActiveTasksCountByService[t.ServiceID]++
 	}
 	}
 
 
 	return true
 	return true

+ 2 - 2
vendor/github.com/docker/swarmkit/manager/scheduler/nodeset.go

@@ -33,8 +33,8 @@ func (ns *nodeSet) addOrUpdateNode(n NodeInfo) {
 	if n.Tasks == nil {
 	if n.Tasks == nil {
 		n.Tasks = make(map[string]*api.Task)
 		n.Tasks = make(map[string]*api.Task)
 	}
 	}
-	if n.DesiredRunningTasksCountByService == nil {
-		n.DesiredRunningTasksCountByService = make(map[string]int)
+	if n.ActiveTasksCountByService == nil {
+		n.ActiveTasksCountByService = make(map[string]int)
 	}
 	}
 	if n.recentFailures == nil {
 	if n.recentFailures == nil {
 		n.recentFailures = make(map[string][]time.Time)
 		n.recentFailures = make(map[string][]time.Time)

+ 3 - 3
vendor/github.com/docker/swarmkit/manager/scheduler/scheduler.go

@@ -517,8 +517,8 @@ func (s *Scheduler) scheduleTaskGroup(ctx context.Context, taskGroup map[string]
 			}
 			}
 		}
 		}
 
 
-		tasksByServiceA := a.DesiredRunningTasksCountByService[t.ServiceID]
-		tasksByServiceB := b.DesiredRunningTasksCountByService[t.ServiceID]
+		tasksByServiceA := a.ActiveTasksCountByService[t.ServiceID]
+		tasksByServiceB := b.ActiveTasksCountByService[t.ServiceID]
 
 
 		if tasksByServiceA < tasksByServiceB {
 		if tasksByServiceA < tasksByServiceB {
 			return true
 			return true
@@ -528,7 +528,7 @@ func (s *Scheduler) scheduleTaskGroup(ctx context.Context, taskGroup map[string]
 		}
 		}
 
 
 		// Total number of tasks breaks ties.
 		// Total number of tasks breaks ties.
-		return a.DesiredRunningTasksCount < b.DesiredRunningTasksCount
+		return a.ActiveTasksCount < b.ActiveTasksCount
 	}
 	}
 
 
 	nodes := s.nodeSet.findBestNodes(len(taskGroup), s.pipeline.Process, nodeLess)
 	nodes := s.nodeSet.findBestNodes(len(taskGroup), s.pipeline.Process, nodeLess)