import graphscope import logging

from graphscope.framework.loader import Loader from graphscope.framework.app import load_app

from kubernetes import client, config

logger = logging.getLogger('graphscope')

config.load_incluster_config()

apiClient = client.ApiClient()

graphscope.set_option(show_log=True) sess = graphscope.session( k8s_namespace='datasimba', etcd_addrs="etcd:2379,", k8s_coordinator_cpu=2.0, k8s_coordinator_mem="8Gi", reconnect=True, k8s_client_config=apiClient )

key = 'your_access_key' secret = 'your_access_secret' endpoint = 'your_endpoint'

ds_index = Loader("oss://your_bucket_name/41index/vertices/index.csv", key = key, secret = secret, endpoint = endpoint) ds_card_no = Loader("oss://your_bucket_name/41index/vertices/card_no.csv", key = key, secret = secret, endpoint = endpoint) ds_mobile = Loader("oss://your_bucket_name/41index/vertices/mobile.csv", key = key, secret = secret, endpoint = endpoint) ds_union_id = Loader("oss://your_bucket_name/41index/vertices/union_id.csv", key = key, secret = secret, endpoint = endpoint)

ds_index2card_no = Loader("oss://your_bucket_name/41index/edges/index_to_card_no.csv", key = key, secret = secret, endpoint = endpoint) ds_index2mobile = Loader("oss://your_bucket_name/41index/edges/index_to_mobile.csv", key = key, secret = secret, endpoint = endpoint) ds_index2union_id = Loader("oss://your_bucket_name/41index/edges/index_to_union_id.csv", key = key, secret = secret, endpoint = endpoint)

vertices = { 'index': [ds_index, None, "id"], 'card_no': [ds_card_no, None, "id"], 'mobile': [ds_mobile, None, "id"], 'union_id': [ds_union_id, None, "id"] } edges = { 'index_to_card_no': [ds_index2card_no, None, (0, 'index'), (1, 'card_no')], 'index_to_mobile': [ds_index2mobile, None, (0, 'index'), (1, 'mobile')], 'index_to_union_id': [ds_index2union_id, None, (0, 'index'), (1, 'union_id')] }

graph = sess.load_from(edges, vertices, directed=False, generate_eid=True)

my_app = load_app('/home/simba/work/src/my_app.gar')

result = my_app(graph)

result.output('oss://your_bucket_name/41index/res.csv', selector = { "id": "v:index.id", "result": "r:index" }, key = key, secret = secret, endpoint = endpoint)

sess.close() print(12345

翻译一下import graphscopeimport logging from graphscopeframeworkloader import Loaderfrom graphscopeframeworkapp import load_app from kubernetes import client config logger = logginggetLoggergraphscope con

原文地址: https://www.cveoy.top/t/topic/gSnA 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录