| 105 | } |
| 106 | |
| 107 | vineyard::ObjectID LoadGiraphFragment( |
| 108 | const grape::CommSpec& comm_spec, const std::string& vfile, |
| 109 | const std::string& efile, const std::string& vertex_input_format_class, |
| 110 | const std::string& edge_input_format_class, vineyard::Client& client, |
| 111 | bool directed) { |
| 112 | // construct graph info |
| 113 | auto graph = std::make_shared<detail::Graph>(); |
| 114 | graph->directed = directed; |
| 115 | graph->generate_eid = false; |
| 116 | graph->retain_oid = false; |
| 117 | |
| 118 | auto vertex = std::make_shared<detail::Vertex>(); |
| 119 | vertex->label = "vertex_label"; |
| 120 | vertex->vid = "0"; |
| 121 | vertex->protocol = "file"; |
| 122 | vertex->values = vfile; |
| 123 | vertex->vformat = vertex_input_format_class; // vif |
| 124 | |
| 125 | graph->vertices.push_back(vertex); |
| 126 | |
| 127 | auto edge = std::make_shared<detail::Edge>(); |
| 128 | edge->label = "edge_label"; |
| 129 | auto subLabel = std::make_shared<detail::Edge::SubLabel>(); |
| 130 | subLabel->src_label = "vertex_label"; |
| 131 | subLabel->src_vid = "0"; |
| 132 | subLabel->dst_label = "vertex_label"; |
| 133 | subLabel->dst_vid = "0"; |
| 134 | subLabel->protocol = "file"; |
| 135 | subLabel->values = efile; |
| 136 | subLabel->eformat += edge_input_format_class; // eif |
| 137 | edge->sub_labels.push_back(*subLabel.get()); |
| 138 | |
| 139 | graph->edges.push_back(edge); |
| 140 | |
| 141 | vineyard::ObjectID fragment_id; |
| 142 | { |
| 143 | auto loader = |
| 144 | std::make_unique<FragmentLoaderType>(client, comm_spec, graph); |
| 145 | fragment_id = |
| 146 | bl::try_handle_all([&loader]() { return loader->LoadFragment(); }, |
| 147 | [](const vineyard::GSError& e) { |
| 148 | LOG(ERROR) << e.error_msg; |
| 149 | return 0; |
| 150 | }, |
| 151 | [](const bl::error_info& unmatched) { |
| 152 | LOG(ERROR) << "Unmatched error " << unmatched; |
| 153 | return 0; |
| 154 | }); |
| 155 | } |
| 156 | |
| 157 | VLOG(1) << "[worker-" << comm_spec.worker_id() |
| 158 | << "] loaded graph to vineyard ..."; |
| 159 | |
| 160 | MPI_Barrier(comm_spec.comm()); |
| 161 | |
| 162 | VLOG(1) << "[worker-" << comm_spec.worker_id() << "] got fragment " |
| 163 | << fragment_id; |
| 164 | return fragment_id; |
no test coverage detected