Skip to content
This repository was archived by the owner on Sep 26, 2020. It is now read-only.

Commit 3d51693

Browse files
committed
Add download dataset
1 parent c4a2eb7 commit 3d51693

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

axon/client.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,20 @@ def impl_download_training_script(local_script_path, bucket_name, region):
512512
print("Downloaded from: {}\n".format(remote_path))
513513

514514

515+
def impl_download_dataset(local_dataset_path, bucket_name, region):
516+
"""
517+
Downloads a dataset from S3.
518+
519+
:param local_dataset_path: The path to the dataset on disk.
520+
:param bucket_name: The S3 bucket name.
521+
:param region: The region.
522+
"""
523+
client = boto3.client("s3", region_name=region)
524+
remote_path = "axon-uploaded-datasets/" + os.path.basename(local_dataset_path)
525+
client.download_file(bucket_name, remote_path, local_dataset_path)
526+
print("Downloaded from: {}\n".format(remote_path))
527+
528+
515529
@click.group()
516530
def cli():
517531
return
@@ -603,3 +617,11 @@ def download_model_file(local_file_path, bucket_name, region):
603617
@click.option("--region", default="us-east-1", help="The region to connect to.")
604618
def download_training_script(local_script_path, bucket_name, region):
605619
impl_download_training_script(local_script_path, bucket_name, region)
620+
621+
622+
@cli.command(name="download-dataset")
623+
@click.argument("local-dataset-path")
624+
@click.argument("bucket-name")
625+
@click.option("--region", default="us-east-1", help="The region to connect to.")
626+
def download_dataset(local_dataset_path, bucket_name, region):
627+
impl_download_dataset(local_dataset_path, bucket_name, region)

0 commit comments

Comments
 (0)