Format the partition to the specified format.
(graph, graph_format)
| 455 | |
| 456 | |
| 457 | def _format_partition(graph, graph_format): |
| 458 | """Format the partition to the specified format.""" |
| 459 | if isinstance(graph, gb.FusedCSCSamplingGraph): |
| 460 | return graph |
| 461 | # formatting dtype |
| 462 | # TODO(Rui) Formatting forcely is not a perfect solution. |
| 463 | # We'd better store all dtypes when mapping to shared memory |
| 464 | # and map back with original dtypes. |
| 465 | for k, dtype in RESERVED_FIELD_DTYPE.items(): |
| 466 | if k in graph.ndata: |
| 467 | graph.ndata[k] = F.astype(graph.ndata[k], dtype) |
| 468 | if k in graph.edata: |
| 469 | graph.edata[k] = F.astype(graph.edata[k], dtype) |
| 470 | # Create the graph formats specified the users. |
| 471 | print( |
| 472 | "Start to create specified graph formats which may take " |
| 473 | "non-trivial time." |
| 474 | ) |
| 475 | graph = graph.formats(graph_format) |
| 476 | graph.create_formats_() |
| 477 | print(f"Finished creating specified graph formats: {graph_format}") |
| 478 | return graph |
| 479 | |
| 480 | |
| 481 | class DistGraphServer(KVServer): |
no test coverage detected