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
14 changes: 0 additions & 14 deletions openprocurement/chronograph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@
gevent.monkey.patch_all()
import os
from logging import getLogger
#from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
from apscheduler.schedulers.gevent import GeventScheduler as Scheduler
from couchdb import Server, Session
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.design import sync_design
from openprocurement.chronograph.managers import MANAGERS_MAPPING
from openprocurement.chronograph.scheduler import push
from openprocurement.chronograph.utils import add_logging_context, get_full_url
from pyramid.config import Configurator
Expand Down Expand Up @@ -100,23 +95,14 @@ def main(global_config, **settings):
LOGGER.info("Updating chronograph db validate doc", extra={'MESSAGE_ID': 'update_chronograph_validate_doc'})
db.save(auth_doc)
# sync couchdb views
sync_design(db)
db = server[db_name]
else:
if db_name not in server:
server.create(db_name)
db = server[db_name]
# sync couchdb views
sync_design(db)
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')})

jobstores = {
#'default': CouchDBJobStore(database=db_name, client=server)
}
Expand Down
30 changes: 0 additions & 30 deletions openprocurement/chronograph/constants.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# -*- coding: utf-8 -*-
from datetime import timedelta, time

CALENDAR_ID = 'calendar'
STREAMS_ID = 'streams'
WORKING_DAY_START = time(11, 0)
INSIDER_WORKING_DAY_START = time(9, 30)
TEXAS_WORKING_DAY_START = time(10, 0)
WORKING_DAY_END = time(16, 0)
INSIDER_WORKING_DAY_DURATION = timedelta(minutes=480)
TEXAS_WORKING_DAY_DURATION = timedelta(hours=7) # Does not affect anything
ROUNDING = timedelta(minutes=29)
MIN_PAUSE = timedelta(minutes=3)
BIDDER_TIME = timedelta(minutes=6)
Expand All @@ -18,25 +10,3 @@
SMOOTHING_REMIN = 60
# value should be greater than SMOOTHING_MIN and SMOOTHING_REMIN
SMOOTHING_MAX = 300
NOT_CLASSIC_AUCTIONS = ['dgfInsider', 'sellout.insider', 'appraisal.insider']
STREAMS_KEYS = ['streams', 'dutch_streams', 'texas_streams']
DEFAULT_STREAMS_DOC = {
'_id': STREAMS_ID,
'streams': 10,
'dutch_streams': 15,
'texas_streams': 20
}

AUCTIONS = [
{
'type': 'insider',
'pmts': ['dgfInsider', 'sellout.insider', 'appraisal.insider']
},
{
'type': 'texas',
'pmts': ['landLease']
},
{
'type': 'english'
}
]
43 changes: 0 additions & 43 deletions openprocurement/chronograph/design.py
Original file line number Diff line number Diff line change
@@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
from couchdb.design import ViewDefinition
from openprocurement.chronograph.constants import (
INSIDER_WORKING_DAY_START, TEXAS_WORKING_DAY_START
)


def sync_design(db):
views = [j for i, j in globals().items() if "_view" in i]
ViewDefinition.sync_many(db, views)


plan_auctions_view = ViewDefinition('plan', 'auctions', '''function(doc) {
if(doc.streams || doc.dutch_streams || doc.texas_streams) {
for (var i in doc) {
if (i.indexOf('stream_') == 0) {
for (var t in doc[i]) {
if (doc[i][t]) {
var x = doc[i][t].split('_')
if (x.length == 2) {
emit(x, doc._id.split('_')[1] + 'T' + t);
} else {
emit([x[0], null],
doc._id.split('_')[1] + 'T' + t);
}
}
}
}
if (i.indexOf('dutch_streams') == 0) {
for (var aid in doc[i]) {
emit([doc[i][aid], null],
doc._id.split('_')[1] + 'T' + '%s');
}
}
if (i.indexOf('texas_streams') == 0) {
for (var aid in doc[i]) {
emit([doc[i][aid], null],
doc._id.split('_')[1] + 'T' + '%s');
}
}
};
}
}''' % (INSIDER_WORKING_DAY_START.isoformat(), TEXAS_WORKING_DAY_START.isoformat()))
222 changes: 0 additions & 222 deletions openprocurement/chronograph/managers.py

This file was deleted.

Loading