Skip to content

Commit a543ed9

Browse files
authored
feat(datasets): remove experimental importer PLA-321 (#357)
1 parent 285bc62 commit a543ed9

File tree

2 files changed

+75
-202
lines changed

2 files changed

+75
-202
lines changed

gradient/cli/datasets.py

Lines changed: 17 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
from gradient.cli.common import ClickGroup, api_key_option
66
from gradient.commands import datasets as commands
77
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
139

1410
EXAMPLE_ID = 'dsr8k5qzn401lb5'
1511
EXAMPLE_VERSION = 'klfoyy9'
@@ -37,11 +33,14 @@ def validate_dataset_id(dataset_ref, ref_type=None):
3733

3834
dataset_id, _, ref = dataset_ref.partition(":")
3935
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))
4138
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))
4341
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))
4544

4645

4746
@cli.group("datasets", help="Manage datasets", cls=ClickGroup)
@@ -149,65 +148,6 @@ def update_dataset(
149148
description=description,
150149
)
151150

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)
211151

212152
@datasets.command("delete", help="Delete dataset")
213153
@click.option(
@@ -370,7 +310,8 @@ def create_dataset_version(
370310
):
371311
validate_dataset_id(dataset_id)
372312
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)
374315

375316

376317
@dataset_versions.command("update", help="Update dataset version")
@@ -467,7 +408,8 @@ def dataset_version_files():
467408
def list_dataset_files(api_key, dataset_version_id, path, recursive, options_file):
468409
validate_dataset_id(dataset_version_id, ref_type='version')
469410
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)
471413

472414

473415
@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
497439
def get_dataset_files(api_key, dataset_version_id, source_paths, target_path, options_file):
498440
validate_dataset_id(dataset_version_id, ref_type='version')
499441
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)
501444

502445

503446
@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
527470
def put_dataset_files(api_key, dataset_version_id, source_paths, target_path, options_file):
528471
validate_dataset_id(dataset_version_id, ref_type='version')
529472
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)
531475

532476

533477
@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
550494
def delete_dataset_files(api_key, dataset_version_id, paths, options_file):
551495
validate_dataset_id(dataset_version_id, ref_type='version')
552496
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

Comments
 (0)