MCPcopy Create free account
hub / github.com/alibaba/graph-learn / init_vineyard

Method init_vineyard

graphlearn/python/graph.py:506–529  ·  view source on GitHub ↗
(self, server_index=None, worker_index=None, worker_count=None,
                    standalone=False)

Source from the content-addressed store, hash-verified

504 self._datasets.append(ds)
505
506 def init_vineyard(self, server_index=None, worker_index=None, worker_count=None,
507 standalone=False):
508 if not self._with_vineyard:
509 raise ValueError('Not a vineyard graph')
510
511 if standalone:
512 self.init()
513 return self
514
515 if server_index is None and worker_index is None:
516 raise ValueError('Cannot decide to launch a server or a worker')
517 if server_index is not None and worker_index is not None:
518 raise ValueError('Cannot be a server and a worker at the same unless standalone is True')
519
520 cluster = {'server': self._vineyard_handle['server'],
521 'client_count': self._vineyard_handle['client_count']}
522 if server_index is not None:
523 # re-target to fragment id, if exists
524 if self._vineyard_handle.get('fragments', None):
525 pywrap.set_vineyard_graph_id(self._vineyard_handle['fragments'][server_index])
526 self.init(cluster=cluster, task_index=server_index, job_name="server")
527 else:
528 self.init(cluster=cluster, task_index=worker_index, job_name="client")
529 return self
530
531 def close(self):
532 self.wait_for_close()

Callers

nothing calls this directly

Calls 2

initMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected