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

Method update

src/examples/java/V1TestFramework.java:248–292  ·  view source on GitHub ↗
(Mesos mesos, TaskStatus status)

Source from the content-addressed store, hash-verified

246 }
247
248 public void update(Mesos mesos, TaskStatus status) {
249 System.out.println(
250 "Status update: task " + status.getTaskId().getValue() +
251 " is in state " + status.getState().getValueDescriptor().getName());
252
253 if (status.getState() == TaskState.TASK_FINISHED) {
254 finishedTasks++;
255 System.out.println("Finished tasks: " + finishedTasks);
256 if (finishedTasks == totalTasks) {
257 lock.lock();
258 try {
259 finished = true;
260 finishedCondtion.signal();
261 } finally {
262 lock.unlock();
263 }
264 }
265 }
266
267 if (status.getState() == TaskState.TASK_LOST ||
268 status.getState() == TaskState.TASK_KILLED ||
269 status.getState() == TaskState.TASK_FAILED) {
270 System.err.println(
271 "Aborting because task " + status.getTaskId().getValue() +
272 " is in unexpected state " +
273 status.getState().getValueDescriptor().getName() +
274 " with reason '" +
275 status.getReason().getValueDescriptor().getName() + "'" +
276 " from source '" +
277 status.getSource().getValueDescriptor().getName() + "'" +
278 " with message '" + status.getMessage() + "'");
279
280 System.exit(1);
281 }
282
283 mesos.send(Call.newBuilder()
284 .setType(Call.Type.ACKNOWLEDGE)
285 .setFrameworkId(frameworkId)
286 .setAcknowledge(Call.Acknowledge.newBuilder()
287 .setAgentId(status.getAgentId())
288 .setTaskId(status.getTaskId())
289 .setUuid(status.getUuid())
290 .build())
291 .build());
292 }
293
294 private enum State {
295 DISCONNECTED,

Callers 1

receivedMethod · 0.95

Calls 6

lockMethod · 0.80
unlockMethod · 0.80
exitMethod · 0.80
sendMethod · 0.65
getStateMethod · 0.45
signalMethod · 0.45

Tested by

no test coverage detected