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

Method sendFrameworkMessage

src/sched/sched.cpp:1572–1620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1570 }
1571
1572 void sendFrameworkMessage(const ExecutorID& executorId,
1573 const SlaveID& slaveId,
1574 const string& data)
1575 {
1576 if (!connected) {
1577 VLOG(1) << "Ignoring send framework message as master is disconnected";
1578 return;
1579 }
1580
1581 VLOG(2) << "Asked to send framework message to agent "
1582 << slaveId;
1583
1584 // TODO(benh): After a scheduler has reregistered it won't have
1585 // any saved slave PIDs, maybe it makes sense to try and save each
1586 // PID that this scheduler tries to send a message to? Or we can
1587 // just wait for them to recollect as new offers come in and get
1588 // accepted.
1589
1590 if (savedSlavePids.count(slaveId) > 0) {
1591 UPID slave = savedSlavePids[slaveId];
1592 CHECK(slave != UPID());
1593
1594 // TODO(vinod): Send a Call directly to the slave once that
1595 // support is added.
1596 FrameworkToExecutorMessage message;
1597 message.mutable_slave_id()->MergeFrom(slaveId);
1598 message.mutable_framework_id()->MergeFrom(framework.id());
1599 message.mutable_executor_id()->MergeFrom(executorId);
1600 message.set_data(data);
1601 send(slave, message);
1602 } else {
1603 VLOG(1) << "Cannot send directly to agent " << slaveId
1604 << "; sending through master";
1605
1606 Call call;
1607
1608 CHECK(framework.has_id());
1609 call.mutable_framework_id()->CopyFrom(framework.id());
1610 call.set_type(Call::MESSAGE);
1611
1612 Call::Message* message = call.mutable_message();
1613 message->mutable_slave_id()->CopyFrom(slaveId);
1614 message->mutable_executor_id()->CopyFrom(executorId);
1615 message->set_data(data);
1616
1617 CHECK_SOME(master);
1618 send(master->pid(), call);
1619 }
1620 }
1621
1622 void reconcileTasks(const vector<TaskStatus>& statuses)
1623 {

Callers

nothing calls this directly

Calls 7

MergeFromMethod · 0.80
CopyFromMethod · 0.80
UPIDClass · 0.50
sendFunction · 0.50
countMethod · 0.45
idMethod · 0.45
pidMethod · 0.45

Tested by

no test coverage detected