Dump a handler for GraphLearn for interaction. Fields in :code:`schema` are: + the name of node type or edge type + whether the graph is weighted graph + whether the graph is labeled graph + the number of int attributes + the number of float attributes + the number of s
(schema, vineyard_id, engine_hosts, engine_config, fragments=None)
| 267 | |
| 268 | |
| 269 | def get_gl_handle(schema, vineyard_id, engine_hosts, engine_config, fragments=None): |
| 270 | """Dump a handler for GraphLearn for interaction. |
| 271 | |
| 272 | Fields in :code:`schema` are: |
| 273 | |
| 274 | + the name of node type or edge type |
| 275 | + whether the graph is weighted graph |
| 276 | + whether the graph is labeled graph |
| 277 | + the number of int attributes |
| 278 | + the number of float attributes |
| 279 | + the number of string attributes |
| 280 | |
| 281 | An example of the graph handle: |
| 282 | |
| 283 | .. code:: python |
| 284 | |
| 285 | { |
| 286 | "server": "127.0.0.1:8888,127.0.0.1:8889", |
| 287 | "client_count": 1, |
| 288 | "vineyard_socket": "/var/run/vineyard.sock", |
| 289 | "vineyard_id": 13278328736, |
| 290 | "fragments": [13278328736, ...], # fragment ids |
| 291 | "node_schema": [ |
| 292 | "user:false:false:10:0:0", |
| 293 | "item:true:false:0:0:5" |
| 294 | ], |
| 295 | "edge_schema": [ |
| 296 | "user:click:item:true:false:0:0:0", |
| 297 | "user:buy:item:true:true:0:0:0", |
| 298 | "item:similar:item:false:false:10:0:0" |
| 299 | ], |
| 300 | "node_attribute_types": { |
| 301 | "person": { |
| 302 | "age": "i", |
| 303 | "name": "s", |
| 304 | }, |
| 305 | }, |
| 306 | "edge_attribute_types": { |
| 307 | "knows": { |
| 308 | "weight": "f", |
| 309 | }, |
| 310 | }, |
| 311 | } |
| 312 | |
| 313 | The handle can be decoded using: |
| 314 | |
| 315 | .. code:: python |
| 316 | |
| 317 | base64.b64decode(handle.encode('ascii', errors="ignore")).decode('ascii', errors="ignore") |
| 318 | |
| 319 | Note that the ports are selected from a range :code:`(8000, 9000)`. |
| 320 | |
| 321 | Args: |
| 322 | schema: The graph schema. |
| 323 | vineyard_id: The object id of graph stored in vineyard. |
| 324 | engine_hosts: A list of hosts for GraphScope engine workers. |
| 325 | engine_config: dict of config for GAE engine. |
| 326 |
no test coverage detected