-
Notifications
You must be signed in to change notification settings - Fork 10
/
cmd_dataset.py
68 lines (54 loc) · 2.06 KB
/
cmd_dataset.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import click
from a2ml.api.a2ml_dataset import A2MLDataset
from a2ml.api.utils.context import pass_context
@click.group('dataset', short_help='Dataset(s) management')
@pass_context
def cmdl(ctx):
"""Dataset(s) management"""
ctx.setup_logger(format='')
@click.command(short_help='List Data Sets on Provider Cloud')
@click.option('--provider', '-p', type=click.Choice(['auger','azure']), required=False,
help='Cloud AutoML Provider.')
@pass_context
def list_cmd(ctx, provider):
"""List Provider remote datasets"""
A2MLDataset(ctx, provider).list()
@click.command(short_help='Create Dataset on Provider Cloud')
@click.argument('source', required=False, type=click.STRING)
@click.option('--provider', '-p', type=click.Choice(['auger','azure']), required=False,
help='Cloud AutoML Provider.')
@pass_context
def create(ctx, provider, source):
"""Create data set on the Provider Cloud.
If source is not specified, config.yaml/source
will be used instead.
"""
A2MLDataset(ctx, provider).create(source)
@click.command(short_help='Delete Dataset on Provider Cloud')
@click.argument('name', required=False, type=click.STRING)
@click.option('--provider', '-p', type=click.Choice(['auger','azure']), required=False,
help='Cloud AutoML Provider.')
@pass_context
def delete(ctx, provider, name):
"""Delete Dataset on the Provider Cloud
If name is not specified, config.yaml/dataset
will be used instead.
"""
A2MLDataset(ctx, provider).delete(name)
@click.command(short_help='Select Dataset')
@click.argument('name', required=False, type=click.STRING)
@click.option('--provider', '-p', type=click.Choice(['auger','azure']), required=False,
help='Cloud AutoML Provider.')
@pass_context
def select(ctx, provider, name):
"""Select data set.
Name will be set in config.yaml/dataset
"""
A2MLDataset(ctx, provider).select(name)
@pass_context
def add_commands(ctx):
cmdl.add_command(list_cmd, name='list')
cmdl.add_command(create)
cmdl.add_command(delete)
cmdl.add_command(select)
add_commands()