Skip to content

Commit ca252cf

Browse files
committed
#11 Add workaround for MESOS-8631
1 parent e385ee3 commit ca252cf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

hpcframework.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ def offer_received(self, offers):
140140
if match_node_group:
141141
cores = get_scalar(attributes, 'cores')
142142
cpus = get_scalar(offer_dict['resources'], 'cpus')
143-
if cores == cpus:
143+
# work around of MESOS-8631
144+
if cpus >= cores - 0.1:
144145
if not self.heartbeat_table.check_fqdn_collision(offer_dict['hostname']):
145146
take_offer = True
146147
if take_offer:
@@ -185,6 +186,13 @@ def accept_offer(self, offer):
185186
task_id = uuid.uuid4().hex
186187
cpus = get_scalar(offer_dict['resources'], 'cpus')
187188

189+
# work around of MESOS-8631
190+
if 'attributes' in offer_dict:
191+
attributes = offer_dict['attributes']
192+
cores = get_scalar(attributes, 'cores')
193+
else:
194+
cores = cpus
195+
188196
task = {
189197
'name': 'hpc pack mesos cn',
190198
'task_id': {'value': task_id},
@@ -194,7 +202,7 @@ def accept_offer(self, offer):
194202
'name': 'cpus',
195203
'type': 'SCALAR',
196204
# work around of MESOS-8631
197-
'scalar': {'value': cpus - 0.1}
205+
'scalar': {'value': cores - 0.1}
198206
},
199207
{
200208
'name': 'mem',

0 commit comments

Comments
 (0)