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

Commit

Permalink
Bug: make node scripts upload in memory (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
jafreck authored Apr 27, 2018
1 parent c98df7d commit 0015e22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion aztk/internal/cluster_data/cluster_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import io
import logging
import yaml
import azure.common
Expand Down Expand Up @@ -39,8 +40,12 @@ def upload_file(self, blob_path: str, local_path: str) -> BlobData:
self.blob_client.create_blob_from_path(self.cluster_id, blob_path, local_path)
return BlobData(self.blob_client, self.cluster_id, blob_path)

def upload_bytes(self, blob_path: str, bytes_io: io.BytesIO) -> BlobData:
self.blob_client.create_blob_from_bytes(self.cluster_id, blob_path, bytes_io.getvalue())
return BlobData(self.blob_client, self.cluster_id, blob_path)

def upload_cluster_file(self, blob_path: str, local_path: str) -> BlobData:
blob_data = self.upload_file(self.CLUSTER_DIR + "/" + blob_path, local_path)
blob_data = self.upload_bytes(self.CLUSTER_DIR + "/" + blob_path, local_path)
blob_data.dest = blob_path
return blob_data

Expand Down
3 changes: 1 addition & 2 deletions aztk/internal/cluster_data/node_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ class NodeData:
"""

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

def add_core(self):
Expand Down

0 comments on commit 0015e22

Please sign in to comment.