Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

Commit 0015e22

Browse files
authored
Bug: make node scripts upload in memory (#519)
1 parent c98df7d commit 0015e22

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

aztk/internal/cluster_data/cluster_data.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import io
12
import logging
23
import yaml
34
import azure.common
@@ -39,8 +40,12 @@ def upload_file(self, blob_path: str, local_path: str) -> BlobData:
3940
self.blob_client.create_blob_from_path(self.cluster_id, blob_path, local_path)
4041
return BlobData(self.blob_client, self.cluster_id, blob_path)
4142

43+
def upload_bytes(self, blob_path: str, bytes_io: io.BytesIO) -> BlobData:
44+
self.blob_client.create_blob_from_bytes(self.cluster_id, blob_path, bytes_io.getvalue())
45+
return BlobData(self.blob_client, self.cluster_id, blob_path)
46+
4247
def upload_cluster_file(self, blob_path: str, local_path: str) -> BlobData:
43-
blob_data = self.upload_file(self.CLUSTER_DIR + "/" + blob_path, local_path)
48+
blob_data = self.upload_bytes(self.CLUSTER_DIR + "/" + blob_path, local_path)
4449
blob_data.dest = blob_path
4550
return blob_data
4651

aztk/internal/cluster_data/node_data.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ class NodeData:
2424
"""
2525

2626
def __init__(self, cluster_config: models.ClusterConfiguration):
27-
self.zip_path = os.path.join(ROOT_PATH, "tmp/node-scripts.zip")
27+
self.zip_path = io.BytesIO()
2828
self.cluster_config = cluster_config
29-
file_utils.ensure_dir(self.zip_path)
3029
self.zipf = zipfile.ZipFile(self.zip_path, "w", zipfile.ZIP_DEFLATED)
3130

3231
def add_core(self):

0 commit comments

Comments
 (0)