本文整理汇总了C++中ExecutorID::value方法的典型用法代码示例。如果您正苦于以下问题:C++ ExecutorID::value方法的具体用法?C++ ExecutorID::value怎么用?C++ ExecutorID::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExecutorID
的用法示例。
在下文中一共展示了ExecutorID::value方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: frameworkMessage
virtual void frameworkMessage(SchedulerDriver* driver,
const ExecutorID& executorId,
const SlaveID& slaveId,
const string& data)
{
vector<string> strVector = stringToVector(data);
string taskId = strVector[0];
string url = strVector[1];
if (executorId.value() == crawler.executor_id().value()) {
cout << "Crawler msg received: " << taskId << endl;
for (size_t i = 2; i < strVector.size(); i++) {
string& newURL = strVector[i];
crawlResults[url].push_back(newURL);
if (processed.find(newURL) == processed.end()) {
processed[newURL] = nextUrlId++;
if (newURL.substr(0, baseUrl.length()) == baseUrl) {
crawlQueue.push(newURL);
}
renderQueue.push(newURL);
}
}
} else {
if (access(strVector[2].c_str(), R_OK) == 0) {
renderResults[url] = strVector[2];
}
}
frameworkMessagesReceived++;
}
示例2: LOG
void CephSchedulerAgent<T>::frameworkMessage(
T* driver,
const ExecutorID& executorId,
const SlaveID& slaveId,
const string& data)
{
ceph::TaskState initialMon = stateMachine->getInitialMon();
if (initialMon.executorId == executorId.value()) {
LOG(INFO) << "Got osd id from inital MON: " << data;
stateMachine->addPendingOSDID(lexical_cast<int>(data));
}
}
示例3: frameworkMessage
void ChapelScheduler::frameworkMessage(SchedulerDriver* driver,
const ExecutorID& executorId,
const SlaveID& slaveId,
const string& data)
{
vector<string> strVector = stringToVector(data);
string taskId = strVector[0];
string url = strVector[1];
if(executorId.value().size() > 0) {
cout << "Framework message received: " << taskId << endl;
}
frameworkMessagesReceived+=1;
}
示例4:
inline bool operator==(const ExecutorID& left, const ExecutorID& right)
{
return left.value() == right.value();
}
示例5:
inline std::size_t hash_value(const ExecutorID& executorId)
{
size_t seed = 0;
boost::hash_combine(seed, executorId.value());
return seed;
}
示例6: Error
Try<ExecutorState> ExecutorState::recover(
const string& rootDir,
const SlaveID& slaveId,
const FrameworkID& frameworkId,
const ExecutorID& executorId,
bool strict,
bool rebooted)
{
ExecutorState state;
state.id = executorId;
string message;
// Find the runs.
Try<list<string>> runs = paths::getExecutorRunPaths(
rootDir,
slaveId,
frameworkId,
executorId);
if (runs.isError()) {
return Error("Failed to find runs for executor '" + executorId.value() +
"': " + runs.error());
}
// Recover the runs.
foreach (const string& path, runs.get()) {
if (Path(path).basename() == paths::LATEST_SYMLINK) {
const Result<string>& latest = os::realpath(path);
if (!latest.isSome()) {
return Error(
"Failed to find latest run of executor '" +
executorId.value() + "': " +
(latest.isError()
? latest.error()
: "No such file or directory"));
}
// Store the ContainerID of the latest executor run.
ContainerID containerId;
containerId.set_value(Path(latest.get()).basename());
state.latest = containerId;
} else {
ContainerID containerId;
containerId.set_value(Path(path).basename());
Try<RunState> run = RunState::recover(
rootDir,
slaveId,
frameworkId,
executorId,
containerId,
strict,
rebooted);
if (run.isError()) {
return Error(
"Failed to recover run " + containerId.value() +
" of executor '" + executorId.value() +
"': " + run.error());
}
state.runs[containerId] = run.get();
state.errors += run->errors;
}
}
// Find the latest executor.
// It is possible that we cannot find the "latest" executor if the
// slave died before it created the "latest" symlink.
if (state.latest.isNone()) {
LOG(WARNING) << "Failed to find the latest run of executor '"
<< executorId << "' of framework " << frameworkId;
return state;
}
// Read the executor info.
const string& path =
paths::getExecutorInfoPath(rootDir, slaveId, frameworkId, executorId);
if (!os::exists(path)) {
// This could happen if the slave died after creating the executor
// directory but before it checkpointed the executor info.
LOG(WARNING) << "Failed to find executor info file '" << path << "'";
return state;
}
Result<ExecutorInfo> executorInfo = state::read<ExecutorInfo>(path);
if (executorInfo.isError()) {
message = "Failed to read executor info from '" + path + "': " +
executorInfo.error();
if (strict) {
return Error(message);
} else {
LOG(WARNING) << message;
state.errors++;
return state;
}
}
//.........这里部分代码省略.........