in graphlearn_torch/v6d/vineyard_utils.cc [32:61]
std::shared_ptr<GraphType> GetGraphFromVineyard(
const std::string& ipc_socket, const std::string& object_id_str) {
// Get the graph via vineyard fragment id from vineyard server.
VINEYARD_CHECK_OK(vyclient.Connect(ipc_socket));
vineyard::ObjectID object_id = vineyard::ObjectIDFromString(object_id_str);
bool exists = false;
if (!vyclient.Exists(object_id, exists).ok() || !exists) {
object_id = std::strtoll(object_id_str.c_str(), nullptr, 10);
}
if (!vyclient.Exists(object_id, exists).ok() || !exists) {
throw std::runtime_error("ERROR: Object not exists!\n");
}
// check if the object is a fragment group
std::shared_ptr<vineyard::ArrowFragmentGroup> fragment_group;
if (vyclient.GetObject(object_id, fragment_group).ok()) {
for (auto const &kv: fragment_group->FragmentLocations()) {
if (kv.second == vyclient.instance_id()) {
object_id = fragment_group->Fragments().at(kv.first);
break;
}
}
}
// try get the fragment
std::shared_ptr<GraphType> frag;
VINEYARD_CHECK_OK(vyclient.GetObject(object_id, frag));
return frag;
}