def main()

in services/daily-ci-reports/report.py [0:0]


def main(task):
    """
    Main handler
    :param task: Which task should be executed
    :return: Nothing
    """
    logging.basicConfig()
    logging.getLogger().setLevel(logging.INFO)

    logging.info(f'Considering following jobs:')

    for job, branches in ENABLED_JOBS.items():
        logging.info(f'{job}')
        if branches is None:
            continue

        for branch in branches:
            logging.info(f'  {branch}')

    logging.info(f'In the following pipelines:')

    for pipe in ENABLED_PIPELINES:
        logging.info(f'{pipe}')

    today = datetime.utcnow().date()
    end = datetime(today.year, today.month, today.day, tzinfo=dateutil.tz.tzutc())
    start = end - timedelta(1)

    logging.info(f'Considering time frame from {start} till {end}')

    if task == 'ci_report':
        generate_ci_report(start=start, end=end)
    elif task == 'github_report':
        generate_github_report(start=start)
    else:
        raise Exception('Unknown task: %s', task)