5
5
from gradient .cli .common import ClickGroup , api_key_option
6
6
from gradient .commands import datasets as commands
7
7
from gradient .cli import common
8
- from gradient .cli .jobs import get_workspace_handler
9
- from gradient .cli .common import (
10
- api_key_option , del_if_value_is_none , ClickGroup , jsonify_dicts ,
11
- validate_comma_split_option ,
12
- )
8
+ from gradient .cli .common import api_key_option , ClickGroup
13
9
14
10
EXAMPLE_ID = 'dsr8k5qzn401lb5'
15
11
EXAMPLE_VERSION = 'klfoyy9'
@@ -37,11 +33,14 @@ def validate_dataset_id(dataset_ref, ref_type=None):
37
33
38
34
dataset_id , _ , ref = dataset_ref .partition (":" )
39
35
if not dataset_id :
40
- raise click .UsageError ("The '--id' option is missing the dataset ID (ex: {}})" .format (full_part ))
36
+ raise click .UsageError (
37
+ "The '--id' option is missing the dataset ID (ex: {}})" .format (full_part ))
41
38
if ref_type and not ref :
42
- raise click .UsageError ("The '--id' option is missing the {} (ex: {})" .format (ref_type , full_part ))
39
+ raise click .UsageError (
40
+ "The '--id' option is missing the {} (ex: {})" .format (ref_type , full_part ))
43
41
elif not ref_type and ref :
44
- raise click .UsageError ("The '--id' option should not have a version/tag (ex: {})" .format (full_part ))
42
+ raise click .UsageError (
43
+ "The '--id' option should not have a version/tag (ex: {})" .format (full_part ))
45
44
46
45
47
46
@cli .group ("datasets" , help = "Manage datasets" , cls = ClickGroup )
@@ -149,65 +148,6 @@ def update_dataset(
149
148
description = description ,
150
149
)
151
150
152
- @datasets .command ("import" , help = "Import dataset" )
153
- @click .option (
154
- "--clusterId" ,
155
- "cluster_id" ,
156
- help = "Cluster ID" ,
157
- cls = common .GradientOption ,
158
- required = True ,
159
- )
160
- @click .option (
161
- "--machineType" ,
162
- "machine_type" ,
163
- help = "Virtual machine type" ,
164
- cls = common .GradientOption ,
165
- required = True ,
166
- )
167
- @click .option (
168
- "--datasetId" ,
169
- "dataset_id" ,
170
- help = "Dataset ID" ,
171
- cls = common .GradientOption ,
172
- required = True ,
173
- )
174
- @click .option (
175
- "--s3Url" ,
176
- "s3_url" ,
177
- help = "S3 URL https://s3-us-east-1.amazonaws.com/bucket/path" ,
178
- cls = common .GradientOption ,
179
- )
180
- @click .option (
181
- "--httpUrl" ,
182
- "http_url" ,
183
- help = "HTTP/S URL https://data.something.org/all_my_data.zip}}" ,
184
- cls = common .GradientOption ,
185
- )
186
- @click .option (
187
- "--httpAuth" ,
188
- "http_auth" ,
189
- help = "Http Auth username:password" ,
190
- cls = common .GradientOption ,
191
- )
192
- @click .option (
193
- "--s3AccessKey" ,
194
- "access_key" ,
195
- help = "S3 access key" ,
196
- cls = common .GradientOption ,
197
- )
198
- @click .option (
199
- "--s3SecretKey" ,
200
- "secret_key" ,
201
- help = "S3 secret key" ,
202
- cls = common .GradientOption ,
203
- )
204
- @api_key_option
205
- @common .options_file
206
- def import_dataset (cluster_id , machine_type , dataset_id , s3_url , http_url , http_auth , access_key , secret_key , api_key , options_file ):
207
- validate_dataset_id (dataset_id )
208
-
209
- command = commands .ImportDatasetCommand (api_key = api_key , workspace_handler = get_workspace_handler ())
210
- command .execute (cluster_id , machine_type , dataset_id , s3_url , http_url , http_auth , access_key , secret_key )
211
151
212
152
@datasets .command ("delete" , help = "Delete dataset" )
213
153
@click .option (
@@ -370,7 +310,8 @@ def create_dataset_version(
370
310
):
371
311
validate_dataset_id (dataset_id )
372
312
command = commands .CreateDatasetVersionCommand (api_key = api_key )
373
- command .execute (dataset_id = dataset_id , message = message , source_paths = source_paths )
313
+ command .execute (dataset_id = dataset_id , message = message ,
314
+ source_paths = source_paths )
374
315
375
316
376
317
@dataset_versions .command ("update" , help = "Update dataset version" )
@@ -467,7 +408,8 @@ def dataset_version_files():
467
408
def list_dataset_files (api_key , dataset_version_id , path , recursive , options_file ):
468
409
validate_dataset_id (dataset_version_id , ref_type = 'version' )
469
410
command = commands .ListDatasetFilesCommand (api_key = api_key )
470
- execute_list (command , dataset_version_id = dataset_version_id , path = path , recursive = recursive )
411
+ execute_list (command , dataset_version_id = dataset_version_id ,
412
+ path = path , recursive = recursive )
471
413
472
414
473
415
@dataset_version_files .command ("get" , help = "Get files" )
@@ -497,7 +439,8 @@ def list_dataset_files(api_key, dataset_version_id, path, recursive, options_fil
497
439
def get_dataset_files (api_key , dataset_version_id , source_paths , target_path , options_file ):
498
440
validate_dataset_id (dataset_version_id , ref_type = 'version' )
499
441
command = commands .GetDatasetFilesCommand (api_key = api_key )
500
- command .execute (dataset_version_id = dataset_version_id , source_paths = source_paths , target_path = target_path )
442
+ command .execute (dataset_version_id = dataset_version_id ,
443
+ source_paths = source_paths , target_path = target_path )
501
444
502
445
503
446
@dataset_version_files .command ("put" , help = "Put files" )
@@ -527,7 +470,8 @@ def get_dataset_files(api_key, dataset_version_id, source_paths, target_path, op
527
470
def put_dataset_files (api_key , dataset_version_id , source_paths , target_path , options_file ):
528
471
validate_dataset_id (dataset_version_id , ref_type = 'version' )
529
472
command = commands .PutDatasetFilesCommand (api_key = api_key )
530
- command .execute (dataset_version_id = dataset_version_id , source_paths = source_paths , target_path = target_path )
473
+ command .execute (dataset_version_id = dataset_version_id ,
474
+ source_paths = source_paths , target_path = target_path )
531
475
532
476
533
477
@dataset_version_files .command ("delete" , help = "Delete files" )
@@ -550,4 +494,5 @@ def put_dataset_files(api_key, dataset_version_id, source_paths, target_path, op
550
494
def delete_dataset_files (api_key , dataset_version_id , paths , options_file ):
551
495
validate_dataset_id (dataset_version_id , ref_type = 'version' )
552
496
command = commands .DeleteDatasetFilesCommand (api_key = api_key )
553
- command .execute (dataset_version_id = dataset_version_id , paths = paths or ['/' ])
497
+ command .execute (dataset_version_id = dataset_version_id ,
498
+ paths = paths or ['/' ])
0 commit comments