|
4 | 4 | import ipify
|
5 | 5 | import webbrowser
|
6 | 6 | import os.path
|
7 |
| -import axon.progress_reporter |
8 | 7 |
|
9 | 8 | all_perm = {
|
10 | 9 | "FromPort": -1,
|
@@ -516,6 +515,20 @@ def impl_download_training_script(local_script_path, bucket_name, region):
|
516 | 515 | print("Downloaded from: {}\n".format(remote_path))
|
517 | 516 |
|
518 | 517 |
|
| 518 | +def impl_upload_dataset(local_dataset_path, bucket_name, region): |
| 519 | + """ |
| 520 | + Uploads a dataset to S3. |
| 521 | +
|
| 522 | + :param local_dataset_path: The path to the dataset on disk. |
| 523 | + :param bucket_name: The S3 bucket name. |
| 524 | + :param region: The region, or `None` to pull the region from the environment. |
| 525 | + """ |
| 526 | + client = make_client("s3", region) |
| 527 | + remote_path = "axon-uploaded-datasets/" + os.path.basename(local_dataset_path) |
| 528 | + client.upload_file(local_dataset_path, bucket_name, remote_path) |
| 529 | + print("Uploaded to: {}\n".format(remote_path)) |
| 530 | + |
| 531 | + |
519 | 532 | def impl_download_dataset(local_dataset_path, bucket_name, region):
|
520 | 533 | """
|
521 | 534 | Downloads a dataset from S3.
|
@@ -629,3 +642,11 @@ def download_training_script(local_script_path, bucket_name, region):
|
629 | 642 | @click.option("--region", default="us-east-1", help="The region to connect to.")
|
630 | 643 | def download_dataset(local_dataset_path, bucket_name, region):
|
631 | 644 | impl_download_dataset(local_dataset_path, bucket_name, region)
|
| 645 | + |
| 646 | + |
| 647 | +@cli.command(name="upload-dataset") |
| 648 | +@click.argument("local-dataset-path") |
| 649 | +@click.argument("bucket-name") |
| 650 | +@click.option("--region", default="us-east-1", help="The region to connect to.") |
| 651 | +def upload_dataset(local_dataset_path, bucket_name, region): |
| 652 | + impl_upload_dataset(local_dataset_path, bucket_name, region) |
0 commit comments