Exemplo n.º 1
0
rpc_result<Res> rpc_mclient::join_(
    const std::string& method,
    const pfi::lang::function<Res(Res, Res)>& reducer) {
  rpc_result<Res> result;

  if (futures_.empty()) {
    throw JUBATUS_EXCEPTION(rpc_no_client() << error_method(method));
  }

  size_t result_count = 0;
  for (size_t i = 0; i < futures_.size(); ++i) {
    try {
      join_one_(method, futures_[i], result, reducer);
      ++result_count;
    } catch (...) {
      // continue process next result when exception thrown.
      // store exception_thrower to list of errors

      result.error.push_back(
          rpc_error(hosts_[i].first, hosts_[i].second,
              jubatus::core::common::exception::get_current_exception()));
    }
  }

  if (result_count == 0) {
    rpc_no_result e;
    if (result.has_error()) {
      e << error_multi_rpc(result.error);
    }
    throw JUBATUS_EXCEPTION(e << error_method(method));
  }

  return result;
}
Exemplo n.º 2
0
void XmlNumInterface::readConvergenceCriteria(QDomElement const& convergence_root)
{
	QDomElement conv_node = convergence_root.firstChildElement();
	double error_threshold(0);
	std::string error_method("");

	while (!conv_node.isNull())
	{
		if (conv_node.nodeName().compare("Method") == 0)
			error_method = conv_node.toElement().text().toStdString();
		if (conv_node.nodeName().compare("ErrorThreshold") == 0)
			error_threshold = conv_node.toElement().text().toDouble();

		conv_node = conv_node.nextSiblingElement();
	}
	INFO("Convergence reached when error below %f using %s.", error_threshold, error_method.c_str());
}