1
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
# Apache Software License 2.0 |
3
|
|
|
# |
4
|
|
|
# Copyright (c) 2018, Christophe Duong |
5
|
|
|
# |
6
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
# you may not use this file except in compliance with the License. |
8
|
|
|
# You may obtain a copy of the License at |
9
|
|
|
# |
10
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
# |
12
|
|
|
# Unless required by applicable law or agreed to in writing, software |
13
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
# See the License for the specific language governing permissions and |
16
|
|
|
# limitations under the License. |
17
|
|
|
""" |
18
|
|
|
Command Line Interface of the AIscalator tool. |
19
|
|
|
|
20
|
|
|
Using the python click package (https://click.palletsprojects.com/en/7.x/), |
21
|
|
|
this module defines all the entry points to the application. |
22
|
|
|
|
23
|
|
|
""" |
24
|
|
|
import logging |
25
|
|
|
import sys |
26
|
|
|
|
27
|
|
|
import click |
28
|
|
|
|
29
|
|
|
from aiscalator import __version__ |
30
|
|
|
from aiscalator.airflow import cli as airflow_cli |
31
|
|
|
from aiscalator.jupyter import cli as jupyter_cli |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
@click.group() |
35
|
|
|
@click.version_option(version=__version__) |
36
|
|
|
def main(): |
37
|
|
|
""" Command Line Interface to Aiscalate your data pipelines """ |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
@main.command() |
41
|
|
|
@click.version_option(version=__version__) |
42
|
|
|
def version(): |
43
|
|
|
"""Show the version and exit.""" |
44
|
|
|
click.echo(sys.argv[0] + ', version ' + __version__) |
45
|
|
|
|
46
|
|
|
|
47
|
|
|
@main.command() |
48
|
|
|
@click.version_option(version=__version__) |
49
|
|
|
def setup(): |
50
|
|
|
"""Setup the configuration of AIscalator applications""" |
51
|
|
|
# TODO to implement |
52
|
|
|
logging.error("Not implemented yet") |
53
|
|
|
|
54
|
|
|
|
55
|
|
|
@main.command() |
56
|
|
|
@click.version_option(version=__version__) |
57
|
|
|
def cookiecutter(): |
58
|
|
|
"""Generates a cookiecutter project to AIscalate""" |
59
|
|
|
# TODO to implement |
60
|
|
|
logging.error("Not implemented yet") |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
main.add_command(airflow_cli.airflow) |
64
|
|
|
main.add_command(jupyter_cli.jupyter) |
65
|
|
|
|
66
|
|
|
# TODO - pull run docker pull to download all images that might be needed |
67
|
|
|
|
68
|
|
|
# TODO - startproject command like cookiecutter to easily start a new |
69
|
|
|
# TODO pipeline/step |
70
|
|
|
|
71
|
|
|
# TODO - store config file path globally with an alias |
72
|
|
|
# TODO and use those shorter alias for easier commands |
73
|
|
|
# TODO - list steps/pipelines/data/etc |
74
|
|
|
|
75
|
|
|
# docker rmi $(docker images --quiet --filter "dangling=true") |
76
|
|
|
# docker kill $(docker ps -q) |
77
|
|
|
|
78
|
|
|
if __name__ == "__main__": |
79
|
|
|
sys.exit(main()) # pragma: no cover |
80
|
|
|
|