MCPcopy Create free account
hub / github.com/alibaba/GraphScope / add_lib

Method add_lib

python/graphscope/client/session.py:1417–1432  ·  view source on GitHub ↗

add the specified resource to the k8s cluster from client machine.

(self, resource_name)

Source from the content-addressed store, hash-verified

1415 return self._nx
1416
1417 def add_lib(self, resource_name):
1418 """
1419 add the specified resource to the k8s cluster from client machine.
1420 """
1421 logger.info("client: adding lib %s", resource_name)
1422 if not os.path.isfile(resource_name):
1423 raise RuntimeError("Resource {} can not be found".format(resource_name))
1424 # pack into a gar file
1425 garfile = InMemoryZip()
1426 resource_reader = open(resource_name, "rb")
1427 bytes_ = resource_reader.read()
1428 if len(bytes_) <= 0:
1429 raise RuntimeError("Expect a non-empty file.")
1430 # the uploaded file may be placed in the same directory
1431 garfile.append(resource_name.split("/")[-1], bytes_)
1432 self._grpc_client.add_lib(garfile.read_bytes().getvalue())
1433
1434
1435session = Session

Callers

nothing calls this directly

Calls 8

appendMethod · 0.95
read_bytesMethod · 0.95
InMemoryZipClass · 0.90
openFunction · 0.85
splitMethod · 0.80
readMethod · 0.65
infoMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected