本文整理汇总了C++中TaskStatus::source方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskStatus::source方法的具体用法?C++ TaskStatus::source怎么用?C++ TaskStatus::source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskStatus
的用法示例。
在下文中一共展示了TaskStatus::source方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool operator == (const TaskStatus& left, const TaskStatus& right)
{
return left.task_id() == right.task_id() &&
left.state() == right.state() &&
left.data() == right.data() &&
left.message() == right.message() &&
left.slave_id() == right.slave_id() &&
left.timestamp() == right.timestamp() &&
left.executor_id() == right.executor_id() &&
left.healthy() == right.healthy() &&
left.source() == right.source() &&
left.reason() == right.reason() &&
left.uuid() == right.uuid();
}
示例2: LOG
void CephSchedulerAgent<T>::statusUpdate(
T* driver,
const TaskStatus& status)
{
LOG(INFO) << "Got status update from " << status.source();
string taskId = status.task_id().value();
if (status.state() == TASK_RUNNING) {
LOG(INFO) << taskId << " is Running!";
stateMachine->updateTaskToRunning(taskId);
if (status.has_message()){
vector<string> tokens = StringUtil::explode(status.message(), '.');
if ((MessageToScheduler)lexical_cast<int>(tokens[0])
== MessageToScheduler::CONSUMED_OSD_ID
){
string consumedOSDId = tokens[1];
LOG(INFO) << "Got message of \"consumed_OSD_ID\": "<<consumedOSDId;
}
}
} else if (status.state() == TASK_STARTING) {
LOG(INFO) << taskId << " is Waiting OSDID, ready for assign osd id!";
stateMachine->updateTaskToWaitingOSDID(taskId);
} else if (status.state() == TASK_FAILED) {
LOG(INFO) << taskId << " failed";
stateMachine->updateTaskToFailed(taskId);
//TODO: if has message , add the OSD ID back to StateMachine
} else if (status.state() == TASK_FINISHED) {
//only disk executor will have this finished status
if (status.has_message()){
vector<string> tokens = StringUtil::explode(status.message(), '.');
if ((MessageToScheduler)lexical_cast<int>(tokens[0])
== MessageToScheduler::DISK_READY
){
string failedDevsStr = tokens[1];
LOG(INFO) << "Got message of \"DISK_READY\": "<<failedDevsStr;
vector<string> failedDevs = StringUtil::explode(failedDevsStr, ':');
string hostname = failedDevs[0];
vector<string> devs;
if ("-" != failedDevs[1]) {
vector<string> devs = StringUtil::explode(failedDevs[1], ',');
}
HostConfig* hostconfig = stateMachine->getConfig(hostname);
//TODO: get this "4" from yml config
hostconfig->updateDiskPartition(devs,lexical_cast<int>("4"));
hostconfig->setDiskPreparationDone();
}
}
}
}
示例3: statusUpdate
virtual void statusUpdate(SchedulerDriver* driver, const TaskStatus& status)
{
std::cout << "Task in state " << status.state() << std::endl;
std::cout << "Source: " << status.source() << std::endl;
std::cout << "Reason: " << status.reason() << std::endl;
if (status.has_message()) {
std::cout << "Message: " << status.message() << std::endl;
}
if (protobuf::isTerminalState(status.state())) {
// NOTE: We expect TASK_FAILED here. The abort here ensures the shell
// script invoking this test, considers the test result as 'PASS'.
if (status.state() == TASK_FAILED) {
driver->abort();
} else {
driver->stop();
}
}
}