Skip to content

Commit

Permalink
LOG formation
Browse files Browse the repository at this point in the history
  • Loading branch information
Leits committed Oct 21, 2015
1 parent e1c1bbd commit c7485bc
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions openprocurement/chronograph/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ def check_tender(tender, db):
except ResourceConflict:
planned = False
auctionPeriod = randomize(auctionPeriod).isoformat()
days = skipped_days(skip_days)
LOG.info('Planned auction for tender {} to {}'.format(tender['id'], auctionPeriod))
days = skipped_days((parse_date(auctionPeriod) - tenderPeriodEnd).days)
log_extra = {'MESSAGE_ID': 'Planned_auction_for_tender', 'JOURNAL_PLANNED_DATE': auctionPeriod, 'JOURNAL_PLANNED_STREAM': stream, 'JOURNAL_PLANNED_DAYS_SKIPPED':(parse_date(auctionPeriod) - tenderPeriodEnd).days }
LOG.info('Planned auction for tender {} to {}. Stream {}. {}'.format(tender['id'], auctionPeriod, stream, days), extra=log_extra)
return {'auctionPeriod': {'startDate': auctionPeriod}}, now
elif tender.get('lots') and tender['status'] == 'active.tendering' and not tender.get('auctionPeriod') and tenderPeriodEnd and tenderPeriodEnd > now:
quick = os.environ.get('SANDBOX_MODE', False) and u'quick' in tender.get('submissionMethodDetails', '')
Expand Down Expand Up @@ -224,8 +225,9 @@ def check_tender(tender, db):
except ResourceConflict:
planned = False
auctionPeriod = randomize(auctionPeriod).isoformat()
days = skipped_days(skip_days)
LOG.info('Planned auction for tender {} to {}'.format(tender['id'], auctionPeriod))
days = skipped_days((parse_date(auctionPeriod) - tenderPeriodEnd).days)
log_extra = {'MESSAGE_ID': 'Planned_auction_for_tender', 'JOURNAL_PLANNED_DATE': auctionPeriod, 'JOURNAL_PLANNED_STREAM': stream, 'JOURNAL_PLANNED_DAYS_SKIPPED':(parse_date(auctionPeriod) - tenderPeriodEnd).days }
LOG.info('Planned auction for tender {} to {}. Stream {}.{}'.format(tender['id'], auctionPeriod, stream, days), extra=log_extra)
return {'auctionPeriod': {'startDate': auctionPeriod}}, now
elif not tender.get('lots') and tender['status'] == 'active.auction' and tender.get('auctionPeriod'):
tenderAuctionStart = parse_date(tender.get('auctionPeriod', {}).get('startDate'), TZ).astimezone(TZ)
Expand All @@ -240,8 +242,9 @@ def check_tender(tender, db):
except ResourceConflict:
planned = False
auctionPeriod = randomize(auctionPeriod).isoformat()
days = skipped_days(skip_days)
LOG.info('Replanned auction for tender {} to {}'.format(tender['id'], auctionPeriod))
days = skipped_days((parse_date(auctionPeriod) - tenderPeriodEnd).days)
log_extra = {'MESSAGE_ID': 'Planned_auction_for_tender', 'JOURNAL_PLANNED_DATE': auctionPeriod, 'JOURNAL_PLANNED_STREAM': stream, 'JOURNAL_PLANNED_DAYS_SKIPPED':(parse_date(auctionPeriod) - tenderPeriodEnd).days }
LOG.info('Replanned auction for tender {} to {}. Stream {}.{}'.format(tender['id'], auctionPeriod, stream, days), extra=log_extra)
return {'auctionPeriod': {'startDate': auctionPeriod}}, now
else:
return None, tenderAuctionEnd + MIN_PAUSE
Expand Down

0 comments on commit c7485bc

Please sign in to comment.