#!/usr/bin/env python

from ptero_common.janitors.redis_janitor import RedisJanitor
from ptero_common.janitors.rabbitmq_janitor import RabbitMQJanitor
from ptero_common.janitors import perform_cleanup
import os


def janitor_factory():
    janitors = []

    janitors.append(RabbitMQJanitor(os.environ['PTERO_WORKFLOW_CELERY_BROKER_URL']))
    janitors.append(RedisJanitor(url=os.environ['PTERO_WORKFLOW_CELERY_RESULT_BACKEND']))

    return janitors


if __name__ == '__main__':
    perform_cleanup(janitor_factory=janitor_factory, required_envvars=[
        'PTERO_WORKFLOW_CELERY_BROKER_URL',
        'PTERO_WORKFLOW_CELERY_RESULT_BACKEND',
    ])
