add the specified resource to the k8s cluster from client machine.
(self, resource_name)
| 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 | |
| 1435 | session = Session |
nothing calls this directly
no test coverage detected