Esempio n. 1
0
def main():
    """
    Run the scheduler metrics jobs after loading the test configuration and
    clearing old instances of dags and tasks
    """
    max_runtime_secs = MAX_RUNTIME_SECS
    if len(sys.argv) > 1:
        try:
            max_runtime_secs = int(sys.argv[1])
            if max_runtime_secs < 1:
                raise ValueError
        except ValueError:
            logging.error('Specify a positive integer for timeout.')
            sys.exit(1)

    conf.load_test_config()

    set_dags_paused_state(False)
    clear_dag_runs()
    clear_dag_task_instances()

    job = SchedulerMetricsJob(dag_ids=DAG_IDS,
                              subdir=SUBDIR,
                              max_runtime_secs=max_runtime_secs)

    job.run()
def main():
    global MAX_RUNTIME_SECS
    if len(sys.argv) > 1:
        try:
            max_runtime_secs = int(sys.argv[1])
            if max_runtime_secs < 1:
                raise ValueError
            MAX_RUNTIME_SECS = max_runtime_secs
        except ValueError:
            logging.error('Specify a positive integer for timeout.')
            sys.exit(1)

    conf.load_test_config()

    set_dags_paused_state(False)
    clear_dag_runs()
    clear_dag_task_instances()

    job = SchedulerMetricsJob(dag_ids=DAG_IDS, subdir=SUBDIR)
    job.run()
 def setUp(self):
     conf.load_test_config()
     self.app, self.appbuilder = application.create_app(testing=True)
Esempio n. 4
0
import airflow
from airflow.models import DagBag
from airflow.configuration import conf
from os import environ

conf.load_test_config()

environ['AIRTABLE_API_KEY'] = 'xxxx'


def test_dagbag_imports():
    '''
    Ensure the DAG is importable
    '''
    dagbag = DagBag()

    assert not dagbag.import_errors


def test_dag_does_something():
    '''
    Ensure end tasks are present in the DAG
    '''
    dagbag = DagBag()
    dag = dagbag.get_dag('syncing_movie_and_tv_data')

    assert dag.get_task('extract_airtable_shows')
 def setUp(self):
     conf.load_test_config()
     self.app, self.appbuilder = application.create_app(testing=True)