Пример #1
0
    def list(cls, args):
        try:
            print(colored("Available {} :".format(args.type), 'green'))
            print('\n'.join(map(str, Utility.read_meta()[args.type])))

        except Exception as e:
            raise AfctlParserException(e)
Пример #2
0
 def get_subparsers(cls):
     subparsers = ({
         'func':
         cls.init,
         'parser':
         'init',
         'help':
         'Create a new Airflow project.',
         'args': [['name', {
             'help': 'Name of your airflow project'
         }], ['-v', {
             'help': 'Airflow version for your project'
         }]]
     }, {
         'func':
         cls.list,
         'parser':
         'list',
         'help':
         'Get list of operators, sensors, connectors and  hooks.',
         'args': [[
             'type', {
                 'choices': ['operators', 'sensors', 'deployment', 'hooks'],
                 'help': 'Choose from the options.'
             }
         ]]
     }, {
         'func':
         cls.config,
         'parser':
         'config',
         'help':
         'Setup configs for your project. Read documentation for argument types.\n'
         + 'TYPES:\n' + '   add - add a config for your deployment.\n' +
         '   update - update an existing config for your deployment.\n' +
         '       Arguments:\n' + '           -d : Deployment Type\n' +
         '           -p : Project\n' + DeploymentConfig.CONFIG_DETAILS +
         '   global\n' + '       Arguments:\n' +
         '           -p : Project\n' +
         '           -o : Set git origin for deployment\n' +
         '           -t : Set personal access token\n' +
         '   show -  Show the config file on console\n' +
         '       No arguments.',
         'args':
         [['type', {
             'choices': ['add', 'update', 'show', 'global']
         }], ['-d', {
             'choices': ['qubole']
         }], ['-o'], ['-p'], ['-n'], ['-e'], ['-c'], ['-t'], ['-v']]
     }, {
         'func':
         cls.deploy,
         'parser':
         'deploy',
         'help':
         'Deploy your afctl project on the preferred platform.\n' +
         'TYPES:\n' + DeploymentConfig.DEPLOY_DETAILS,
         'args': [['type', {
             'choices': Utility.read_meta()['deployment']
         }], ['-d', {
             'action': 'store_true'
         }], ['-n']]
     }, {
         'func':
         cls.generate,
         'parser':
         'generate',
         'help':
         'Generators\n' + '-n : Name of the dag file or the module\n' +
         '-m : Name of module where you want to generate a dag file\n',
         'args': [['type', {
             'choices': ['dag', 'module']
         }], ['-n', {
             'required': 'True'
         }], ['-m']]
     })
     return subparsers