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

Method registered

src/slave/slave.cpp:1675–1797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1673
1674
1675void Slave::registered(
1676 const UPID& from,
1677 const SlaveID& slaveId,
1678 const MasterSlaveConnection& connection)
1679{
1680 if (master != from) {
1681 LOG(WARNING) << "Ignoring registration message from " << from
1682 << " because it is not the expected master: "
1683 << (master.isSome() ? stringify(master.get()) : "None");
1684 return;
1685 }
1686
1687 CHECK_SOME(master);
1688
1689 if (connection.has_total_ping_timeout_seconds()) {
1690 masterPingTimeout =
1691 Seconds(static_cast<int64_t>(connection.total_ping_timeout_seconds()));
1692 } else {
1693 masterPingTimeout = DEFAULT_MASTER_PING_TIMEOUT();
1694 }
1695
1696 switch (state) {
1697 case DISCONNECTED: {
1698 LOG(INFO) << "Registered with master " << master.get()
1699 << "; given agent ID " << slaveId;
1700
1701 state = RUNNING;
1702
1703 // Cancel the pending registration timer to avoid spurious attempts
1704 // at reregistration. `Clock::cancel` is idempotent, so this call
1705 // is safe even if no timer is active or pending.
1706 Clock::cancel(agentRegistrationTimer);
1707
1708 taskStatusUpdateManager->resume(); // Resume status updates.
1709
1710 info.mutable_id()->CopyFrom(slaveId); // Store the slave id.
1711
1712 // Create the slave meta directory.
1713 paths::createSlaveDirectory(metaDir, slaveId);
1714
1715 // Initialize and resume the operation status update manager.
1716 //
1717 // NOTE: There is no need to recover the operation status update manager,
1718 // because its streams are checkpointed within the slave meta directory
1719 // which was just created.
1720 operationStatusUpdateManager.initialize(
1721 defer(self(), &Self::sendOperationStatusUpdate, lambda::_1),
1722 std::bind(
1723 &slave::paths::getSlaveOperationUpdatesPath,
1724 metaDir,
1725 info.id(),
1726 lambda::_1));
1727
1728 operationStatusUpdateManager.resume();
1729
1730 // Checkpoint slave info.
1731 const string path = paths::getSlaveInfoPath(metaDir, slaveId);
1732

Callers

nothing calls this directly

Calls 15

SecondsClass · 0.85
createSlaveDirectoryFunction · 0.85
deferFunction · 0.85
getSlaveInfoPathFunction · 0.85
checkpointFunction · 0.85
protobufFunction · 0.85
CopyFromMethod · 0.80
startMethod · 0.65
stringifyFunction · 0.50
bindFunction · 0.50
delayFunction · 0.50

Tested by

no test coverage detected