Last active
August 10, 2017 18:44
-
-
Save wackywendell/ac0ac531efa9689d0603bc02883c54a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from delancie.backend import DelancieBackend | |
from dd.utils.cli import parse_date | |
from dd.utils.context.aggr_metric import AggrMetricService | |
from delancie.tasks.marlo_backfill import MarloBackfill, MarloBackfillJob, DEFAULT_TIMEOUT | |
log = logging.getLogger("dd.delancie.tasks.marlo_backfill") | |
start_date = parse_date('2017-08-10 17:55') | |
end_date = parse_date('2017-08-10 18:30') | |
delancie = DelancieBackend.instance() | |
log.info('started MarloBackfillEnqueue for all orgs, start_date:%r end_date:%r', | |
start_date, end_date) | |
for aggr_metric in AggrMetricService.list(): | |
if not 21396 <= (org_id % (2 ** 15)) <= 22381: | |
continue | |
job = MarloBackfillJob(klass=MarloBackfill, | |
kwargs=dict(org_id=aggr_metric.org_id, | |
aggr_key=aggr_metric.key, | |
start_date=start_date.isoformat(), | |
end_date=end_date.isoformat()), | |
max_failures=3, | |
timeout=DEFAULT_TIMEOUT) | |
log.info('enqueing MarloBackfill for org_id:%r aggr_key:%r start_date:%r end_date:%r', | |
aggr_metric.org_id, aggr_metric.key, start_date, end_date) | |
delancie.enqueue_job(job) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment