Exemplo n.º 1
0
def process_run():

    try:

        scan = Scan.get_not_started_run()
        if scan is not None:
            scan.status = "pending"
            metrics_session.commit()

            for_time = scan.start_date
            while for_time <= scan.end_date:

                conf = Conf(for_time)

                for source_db in DataSource.source_dbs():
                    run_check_for_new_tables(source_db, conf)
                    run_checks(source_db, conf)
                    run_compute_alerts(source_db, conf)

                for_time += timedelta(days=1)

            generate_grafana()

            scan.status = "success"
            metrics_session.commit()

    except Exception:

        scan.status = "error"
        metrics_session.commit()
Exemplo n.º 2
0
def add_run():
    scan = Scan(
        start_date=datetime.utcnow(),
        end_date=datetime.utcnow(),
        status="not started",
        run_type="scheduled",
    )

    metrics_session.add(scan)
    metrics_session.commit()