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

Method statusUpdate

src/slave/slave.cpp:5979–6237  ·  view source on GitHub ↗

This can be called in two ways: 1) When a status update from the executor is received. 2) When slave generates task updates (e.g LOST/KILLED/FAILED). NOTE: We set the pid in 'Slave::___statusUpdate()' to 'pid' so that whoever sent this update will get an ACK. This is important because we allow executors to send updates for tasks that belong to other executors. Currently we allow this because we ca

Source from the content-addressed store, hash-verified

5977// unacked updates it is important that whoever sent the update gets
5978// acknowledgement for it.
5979void Slave::statusUpdate(StatusUpdate update, const Option<UPID>& pid)
5980{
5981 LOG(INFO) << "Handling status update " << update
5982 << (pid.isSome() ? " from " + stringify(pid.get()) : "");
5983
5984 CHECK(state == RECOVERING || state == DISCONNECTED ||
5985 state == RUNNING || state == TERMINATING)
5986 << state;
5987
5988 if (!update.has_uuid()) {
5989 LOG(WARNING) << "Ignoring status update " << update << " without 'uuid'";
5990 metrics.invalid_status_updates++;
5991 return;
5992 }
5993
5994 if (update.slave_id() != info.id()) {
5995 LOG(WARNING) << "Ignoring status update " << update << " due to "
5996 << "Slave ID mismatch; expected '" << info.id()
5997 << "', received '" << update.slave_id() << "'";
5998 metrics.invalid_status_updates++;
5999 return;
6000 }
6001
6002 if (update.status().slave_id() != info.id()) {
6003 LOG(WARNING) << "Ignoring status update " << update << " due to "
6004 << "Slave ID mismatch; expected '" << info.id()
6005 << "', received '" << update.status().slave_id() << "'";
6006 metrics.invalid_status_updates++;
6007 return;
6008 }
6009
6010 // TODO(bmahler): With the HTTP API, we must validate the UUID
6011 // inside the TaskStatus. For now, we ensure that the uuid of task
6012 // status matches the update's uuid, in case the executor is using
6013 // pre 0.23.x driver.
6014 update.mutable_status()->set_uuid(update.uuid());
6015
6016 // Set the source and UUID before forwarding the status update.
6017 update.mutable_status()->set_source(
6018 pid == UPID() ? TaskStatus::SOURCE_SLAVE : TaskStatus::SOURCE_EXECUTOR);
6019
6020 // Set TaskStatus.executor_id if not already set; overwrite existing
6021 // value if already set.
6022 if (update.has_executor_id()) {
6023 if (update.status().has_executor_id() &&
6024 update.status().executor_id() != update.executor_id()) {
6025 LOG(WARNING) << "Executor ID mismatch in status update"
6026 << (pid.isSome() ? " from " + stringify(pid.get()) : "")
6027 << "; overwriting received '"
6028 << update.status().executor_id() << "' with expected'"
6029 << update.executor_id() << "'";
6030 }
6031 update.mutable_status()->mutable_executor_id()->CopyFrom(
6032 update.executor_id());
6033 }
6034
6035 Framework* framework = getFramework(update.framework_id());
6036 if (framework == nullptr) {

Callers

nothing calls this directly

Calls 15

deferFunction · 0.85
isTerminalStateFunction · 0.85
NoneClass · 0.85
CopyFromMethod · 0.80
removePendingTaskMethod · 0.80
idleMethod · 0.80
getExecutorMethod · 0.80
addPendingTaskStatusMethod · 0.80
stringifyFunction · 0.50
UPIDClass · 0.50
isSomeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected