def setup_produce_differ_scheduler(stage='all', model_name='all', action='all'): """ instala os schedulers para produzir a diferença nos modelos de ETL. Por padrão aplica para todas as fases, todos os modelos e todas as açoes, EXCETO para artigo. Caso necessite aplicar para artigo, utilizar o comando manual setup_produce_delete_article_differs(). """ stages_list, models_list, actions_list = clean_differ_scheduler_params( stage, model_name, action) print "ESTE PROCESSO NÃO CRIA TAREFAS DE DELEÇÃO DE REGISTROS DE FASCÍCULO E ARTIGO!" "UTILIZE O COMANDO setup_produce_delete_article_differs e setup_produce_delete_issue_differs" for stage_ in stages_list: for model_ in models_list: for action_ in actions_list: if not ((model_ == 'article' or model_ == 'issue') and action_ == 'delete'): sched_class = PRODUCER_SCHEDS[stage_][model_][action_] sched_instance = sched_class() print "[%s][%s][%s] instalando scheduler na fila: %s" % ( stage_, model_, action_, sched_instance.queue_name) sched_instance.setup()
def clear_consume_differ_scheduler(stage='all', model_name='all', action='all'): """ remove os jobs enfilerados nas filas usadas pelos schedulers de consumir as diferencias """ stages_list, models_list, actions_list = clean_differ_scheduler_params( stage, model_name, action) for stage_ in stages_list: for model_ in models_list: for action_ in actions_list: sched_class = CONSUMER_SCHEDS[stage_][model_][action_] sched_instance = sched_class() print "[%s][%s][%s] limpando scheduler na fila: %s" % ( stage_, model_, action_, sched_instance.queue_name) sched_instance.clear_jobs()
def setup_consume_differ_scheduler(stage='all', model_name='all', action='all'): """ instala os schedulers para consumir a diferencia nos modelos de ETL. Por padrão aplica para todas as fases, todos os modelos e todas as açoes """ stages_list, models_list, actions_list = clean_differ_scheduler_params( stage, model_name, action) for stage_ in stages_list: for model_ in models_list: for action_ in actions_list: sched_class = CONSUMER_SCHEDS[stage_][model_][action_] sched_instance = sched_class() print "[%s][%s][%s] instalando scheduler na fila: %s" % ( stage_, model_, action_, sched_instance.queue_name) sched_instance.setup()
def setup_produce_delete_issue_differs(): """ Configura os schedulers para produzir a diferença de deleção nos modelos de ETL SOMENTE para fascículos. Caso necessite aplicar para os demais modelos e operações, utilizar o comando setup_produce_differ_scheduler(). """ stages_list, models_list, actions_list = clean_differ_scheduler_params( 'all', 'issue', 'delete') for stage_ in stages_list: for model_ in models_list: for action_ in actions_list: sched_class = PRODUCER_SCHEDS[stage_][model_][action_] sched_instance = sched_class() print "[%s][%s][%s] instalando scheduler na fila: %s" % ( stage_, model_, action_, sched_instance.queue_name) sched_instance.setup()