Skip to content

Instantly share code, notes, and snippets.

@wackywendell
Last active August 10, 2017 18:44
Show Gist options
  • Save wackywendell/ac0ac531efa9689d0603bc02883c54a4 to your computer and use it in GitHub Desktop.
Save wackywendell/ac0ac531efa9689d0603bc02883c54a4 to your computer and use it in GitHub Desktop.
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