# encoding: utf-8 """Test Azkaban remote module.""" from azkaban.ext.pig import PigJob from azkaban.project import Project from azkaban.job import Job from azkaban.remote import Execution, Session, _parse_url from azkaban.util import (AzkabanError, Config, suppress_urllib_warnings, temppath) from requests.exceptions import HTTPError from six.moves.configparser import NoOptionError, NoSectionError from nose.tools import eq_, ok_, raises, nottest from nose.plugins.skip import SkipTest from time import sleep suppress_urllib_warnings() class _TestSession(object): """Base class to run tests on an Azkaban server. These will be skipped if no valid credentials (url and associated session id) are found. If the class variable `project` is specified, the corresponding project will be created before each test. """ project_name = None session = None
"""Test Azkaban remote module.""" from azkaban.ext.pig import PigJob from azkaban.project import Project from azkaban.job import Job from azkaban.remote import Execution, Session, _parse_url from azkaban.util import (AzkabanError, Config, suppress_urllib_warnings, temppath) from six.moves.configparser import NoOptionError, NoSectionError from nose.tools import eq_, ok_, raises, nottest from nose.plugins.skip import SkipTest from time import sleep suppress_urllib_warnings() class _TestSession(object): """Base class to run tests on an Azkaban server. These will be skipped if no valid credentials (url and associated session id) are found. If the class variable `project` is specified, the corresponding project will be created before each test. """ project_name = None session = None
def main(argv=None): """Entry point.""" # enable general logging logger = lg.getLogger() logger.setLevel(lg.DEBUG) handler = Config().get_file_handler('azkaban') if handler: logger.addHandler(handler) # capture pesky unverified requests warnings suppress_urllib_warnings() # parse arguments argv = argv or sys.argv[1:] _logger.debug('Running command %r from %r.', ' '.join(argv), os.getcwd()) args = docopt(__doc__, version=__version__) CLI_ARGS.update(args) # do things if args['--log']: if handler: sys.stdout.write('%s\n' % (handler.baseFilename, )) else: raise AzkabanError('No log file active.') elif args['build']: build_project( _load_project(args['--project']), **_forward( args, ['ZIP', '--url', '--alias', '--replace', '--create', '--option'] ) ) elif args['log']: view_log( **_forward(args, ['EXECUTION', 'JOB', '--url', '--alias']) ) elif args['info']: view_info( _load_project(args['--project']), **_forward(args, ['--files', '--option', 'JOB', '--include-properties']) ) elif args['run']: run_workflow( _get_project_name(args['--project']), **_forward( args, [ 'FLOW', 'JOB', '--bounce', '--url', '--alias', '--kill', '--email', '--option', ] ) ) elif args['schedule']: schedule_workflow( _get_project_name(args['--project']), **_forward( args, [ 'FLOW', 'JOB', '--bounce', '--url', '--alias', '--kill', '--email', '--option', '--date', '--time', '--span' ] ) ) elif args['upload']: upload_project( _get_project_name(args['--project']), **_forward(args, ['ZIP', '--create', '--url', '--alias']) )