| 176 | } |
| 177 | |
| 178 | bl::result<void> GrapeInstance::unloadGraph(const rpc::GSParams& params) { |
| 179 | BOOST_LEAF_AUTO(graph_name, params.Get<std::string>(rpc::GRAPH_NAME)); |
| 180 | if (params.HasKey(rpc::VINEYARD_ID)) { |
| 181 | BOOST_LEAF_AUTO(frag_group_id, params.Get<int64_t>(rpc::VINEYARD_ID)); |
| 182 | bool exists = false; |
| 183 | VY_OK_OR_RAISE(client_->Exists(frag_group_id, exists)); |
| 184 | if (exists) { |
| 185 | std::shared_ptr<vineyard::ArrowFragmentGroup> fg; |
| 186 | VY_OK_OR_RAISE(client_->GetObject(frag_group_id, fg)); |
| 187 | auto fid = comm_spec_.WorkerToFrag(comm_spec_.worker_id()); |
| 188 | auto frag_id = fg->Fragments().at(fid); |
| 189 | |
| 190 | // ensure all workers obtain the expected information |
| 191 | MPI_Barrier(comm_spec_.comm()); |
| 192 | |
| 193 | // delete the fragment group first |
| 194 | if (comm_spec_.worker_id() == 0) { |
| 195 | #if defined(VINEYARD_VERSION) && VINEYARD_VERSION >= 21003 |
| 196 | VINEYARD_SUPPRESS(client_->DelData(frag_group_id, false, true, true)); |
| 197 | #else |
| 198 | VINEYARD_SUPPRESS(client_->DelData(frag_group_id, false, true)); |
| 199 | #endif |
| 200 | } |
| 201 | // ensure all fragments get deleted |
| 202 | MPI_Barrier(comm_spec_.comm()); |
| 203 | #if defined(VINEYARD_VERSION) && VINEYARD_VERSION >= 21003 |
| 204 | VINEYARD_SUPPRESS(client_->DelData(frag_id, false, true, true)); |
| 205 | #else |
| 206 | VINEYARD_SUPPRESS(client_->DelData(frag_id, false, true)); |
| 207 | #endif |
| 208 | } |
| 209 | } |
| 210 | VLOG(1) << "Unloading Graph " << graph_name; |
| 211 | return object_manager_.RemoveObject(graph_name); |
| 212 | } |
| 213 | |
| 214 | bl::result<void> GrapeInstance::archiveGraph(const rpc::GSParams& params) { |
| 215 | if (params.HasKey(rpc::VINEYARD_ID)) { |
nothing calls this directly
no test coverage detected