Skip to content

Commit d6501be

Browse files
committed
ADD: mesos attributes
1 parent 8eb6956 commit d6501be

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3.9'
2+
services:
3+
test1:
4+
image: docker.io/avhost/docker-lighttpd
5+
restart: always
6+
network: default
7+
deploy:
8+
placement:
9+
attributes:
10+
- "gpu: True"
11+
replicas: 1
12+

scheduler/handle_offers.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,17 @@ func (e *Scheduler) matchAttributes(cmd *cfg.Command, offer *mesosproto.Offer) b
168168
return true
169169
}
170170

171-
ret := false;
171+
ret := true;
172172
for _, attribute := range cmd.Attributes {
173-
if strings.EqualFold("true", e.getAttributes(*attribute.Key, offer)) {
173+
cmdAttr := strings.Replace(*attribute.Value, " ", "", -1)
174+
offerAttr := strings.Replace(e.getAttributes(*attribute.Key, offer), " ", "", -1)
175+
if strings.EqualFold(cmdAttr, offerAttr) {
174176
ret = ret && true
177+
} else {
178+
ret = false
175179
}
176180
}
181+
177182
return ret
178183
}
179184

0 commit comments

Comments
 (0)