def run_multilot(worker_cmd, tender_file_path, auction_id):
    with open(tender_file_path) as _file:
        data = json.load(_file).get('data', {})
        lot_id = data.get('lots', [])[0].get('id')
    with update_auctionPeriod(tender_file_path,
                              auction_type='multilot') as auction_file:
        command_line = worker_cmd.format(CWD, auction_id, auction_file, lot_id)
        check_output(command_line.split())
    sleep(10)
def auction(request):
    defaults = {'time': MIN_AUCTION_START_TIME_RESERV,
                'delta_t': datetime.timedelta(seconds=10)}

    params = getattr(request, 'param', defaults)
    for key in defaults.keys():
        params[key] = defaults[key] if params.get(key, 'default') == 'default'\
            else params[key]

    with update_auctionPeriod(
            AUCTION_DATA['simple']['path'],
            auction_type='simple',
            time_shift=params['time']+params['delta_t']) \
            as updated_doc, open(updated_doc, 'r') as auction_updated_data:
        auction_inst = Auction(
            tender_id=AUCTION_DATA['simple']['data']['data']['tenderID'],
            worker_defaults=yaml.load(open(worker_defaults_file_path)),
            auction_data=json.load(auction_updated_data),
            lot_id=False)

    return auction_inst
Example #3
0
def auction(request):
    defaults = {
        'time': MIN_AUCTION_START_TIME_RESERV,
        'delta_t': datetime.timedelta(seconds=10)
    }

    params = getattr(request, 'param', defaults)
    for key in defaults.keys():
        params[key] = defaults[key] if params.get(key, 'default') == 'default'\
            else params[key]

    with update_auctionPeriod(
            AUCTION_DATA['simple']['path'],
            auction_type='simple',
            time_shift=params['time']+params['delta_t']) \
            as updated_doc, open(updated_doc, 'r') as auction_updated_data:
        auction_inst = Auction(
            tender_id=AUCTION_DATA['simple']['data']['data']['tenderID'],
            worker_defaults=yaml.load(open(worker_defaults_file_path)),
            auction_data=json.load(auction_updated_data),
            lot_id=False)

    return auction_inst
def run_esco(worker_cmd, tender_file_path, auction_id):
    with update_auctionPeriod(tender_file_path, auction_type='simple')\
            as auction_file:
        check_output(worker_cmd.format(CWD, auction_id, auction_file).split())
    sleep(10)