MCPcopy Create free account
hub / github.com/apache/mesos / statusUpdate

Method statusUpdate

src/examples/python/test_framework.py:103–137  ·  view source on GitHub ↗
(self, driver, update)

Source from the content-addressed store, hash-verified

101 driver.acceptOffers([offer.id], [operation])
102
103 def statusUpdate(self, driver, update):
104 print "Task %s is in state %s" % \
105 (update.task_id.value, mesos_pb2.TaskState.Name(update.state))
106
107 # Ensure the binary data came through.
108 if update.data != "data with a \0 byte":
109 print "The update data did not match!"
110 print " Expected: 'data with a \\x00 byte'"
111 print " Actual: ", repr(str(update.data))
112 sys.exit(1)
113
114 if update.state == mesos_pb2.TASK_FINISHED:
115 self.tasksFinished += 1
116 if self.tasksFinished == TOTAL_TASKS:
117 print "All tasks done, waiting for final framework message"
118
119 slave_id, executor_id = self.taskData[update.task_id.value]
120
121 self.messagesSent += 1
122 driver.sendFrameworkMessage(
123 executor_id,
124 slave_id,
125 'data with a \0 byte')
126
127 if update.state == mesos_pb2.TASK_LOST or \
128 update.state == mesos_pb2.TASK_KILLED or \
129 update.state == mesos_pb2.TASK_FAILED:
130 print "Aborting because task %s is in unexpected state %s with message '%s'" \
131 % (update.task_id.value, mesos_pb2.TaskState.Name(update.state), update.message)
132 driver.abort()
133
134 # Explicitly acknowledge the update if implicit acknowledgements
135 # are not being used.
136 if not self.implicitAcknowledgements:
137 driver.acknowledgeStatusUpdate(update)
138
139 def frameworkMessage(self, driver, executorId, slaveId, message):
140 self.messagesReceived += 1

Callers

nothing calls this directly

Calls 5

exitMethod · 0.80
sendFrameworkMessageMethod · 0.65
abortMethod · 0.65
NameMethod · 0.45

Tested by

no test coverage detected