Skip to content

Commit 84e4df0

Browse files
committed
Add "magic" explanation
1 parent b660489 commit 84e4df0

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

openprocurement/auction/chronograph.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ def sigusr1():
117117
# ADD FILTER BY VALUE
118118
# {start: '2016-09-10T14:36:40.378777+03:00', test: false}
119119
if datestamp < auction_item['value']['start']:
120+
# running __call__ method of core.ChronographManager, which
121+
# returns instance of core.RunDispatcher, initialized with
122+
# current instance of AuctionsChronograph and auction_item if
123+
# value of procurementMethodType field in feed object was
124+
# registered during entry_points loading, else returns None
120125
worker_cmd_provider = \
121126
self.mapper(FeedItem(auction_item['value']))
122127
if not worker_cmd_provider:

openprocurement/auction/databridge.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,34 @@ def run(self):
7575
self.run_re_planning()
7676
return
7777

78+
# getting auction items from api by
79+
# openprocurement_client.sync.ResourceFeeder
7880
for item in self.feeder.get_resource_items():
7981
# magic goes here
82+
# munch auction item fields specified in API_EXTRA['opt_fields']
8083
feed = FeedItem(item)
84+
# running __call__ method of core.DatabridgeManager, which returns
85+
# instance of core.Planning, initialized with current instance of
86+
# AuctionsDataBridge and feed object if value of
87+
# procurementMethodType field in feed object was registered during
88+
# entry_points loading, else returns None
8189
planning = self.mapper(feed)
82-
if not planning:
90+
if not planning: # if procurementMethodType is not registered
8391
continue
92+
# calling __iter__ method of core.Planning's instance
93+
# got from previous step
8494
for cmd, item_id, lot_id in planning:
8595
if lot_id:
8696
LOGGER.info('Lot {} of tender {} selected for {}'.format(
8797
lot_id, item_id, cmd))
8898
else:
8999
LOGGER.info('Tender {} selected for {}'.format(item_id,
90100
cmd))
101+
# calling __call__ method of core.Planning's instance which
102+
# prepares all needed arguments and returns result of
103+
# gevent.subprocess.check_call function, which runs certain
104+
# auction worker, depending on value of procurementMethodType of
105+
# feed object
91106
planning(cmd, item_id, lot_id=lot_id)
92107

93108
def run_re_planning(self):

0 commit comments

Comments
 (0)