Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions openprocurement/chronograph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from couchdb.http import Unauthorized, extract_credentials
from datetime import datetime, timedelta
#from openprocurement.chronograph.jobstores import CouchDBJobStore
from openprocurement.chronograph.constants import AUCTIONS
from openprocurement.chronograph.constants import DEFAULT_AUCTION_TYPE
from openprocurement.chronograph.design import sync_design
from openprocurement.chronograph.managers import MANAGERS_MAPPING
from openprocurement.chronograph.scheduler import push
Expand Down Expand Up @@ -111,11 +111,15 @@ def main(global_config, **settings):
config.registry.db = db

config.registry.manager_mapper = {'types': {}, 'pmts': {}}
for auction in AUCTIONS:
auction_manager = MANAGERS_MAPPING[auction['type']]()
config.registry.manager_mapper['types'][auction['type']] = auction_manager
if auction.get('pmts', []):
config.registry.manager_mapper['pmts'].update({pmt: auction_manager for pmt in auction.get('pmts')})
auctions = settings.get('auctions', DEFAULT_AUCTION_TYPE).split(',')
for auction in auctions:
auction_manager = MANAGERS_MAPPING[auction]()
config.registry.manager_mapper['types'][auction] = auction_manager
pmts = settings.get(auction)
if pmts:
config.registry.manager_mapper['pmts'].update(
{pmt: auction_manager for pmt in pmts.split(',')}
)

jobstores = {
#'default': CouchDBJobStore(database=db_name, client=server)
Expand Down
15 changes: 1 addition & 14 deletions openprocurement/chronograph/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,4 @@
'dutch_streams': 15,
'texas_streams': 20
}

AUCTIONS = [
{
'type': 'insider',
'pmts': ['dgfInsider', 'sellout.insider']
},
{
'type': 'texas',
'pmts': ['landLease']
},
{
'type': 'english'
}
]
DEFAULT_AUCTION_TYPE = 'english'
4 changes: 4 additions & 0 deletions openprocurement/chronograph/tests/chronograph.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ pyramid.default_locale_name = en

planning = 1

auctions = insider,texas,english
insider = dgfInsider,sellout.insider
texas = landLease

[server:main]
use = egg:chaussette
host = 0.0.0.0
Expand Down
5 changes: 3 additions & 2 deletions openprocurement/chronograph/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
SERVICE_TIME,
SMOOTHING_MIN,
SMOOTHING_MAX,
DEFAULT_STREAMS_DOC
DEFAULT_STREAMS_DOC,
DEFAULT_AUCTION_TYPE
)

POOL = Pool(1)
Expand Down Expand Up @@ -195,7 +196,7 @@ def get_request(url, auth, session, headers=None):


def get_manager_for_auction(auction, mapper):
default_manager = mapper['types'].get('english', None)
default_manager = mapper['types'].get(DEFAULT_AUCTION_TYPE, None)

auction_type = auction.get('auctionParameters', {}).get('type', None)
if auction_type:
Expand Down