示例#1
0
def cluster():
    o = curiousorm.Connection(dsn, dictrows=True)
    o.execute('CLUSTER')
    o.close()
示例#2
0
            matched_commitments.insert(bond2commitment(*b), flush_if_full=False)
        matched_commitments.flush_if_full()

    matched_commitments.flush()



if __name__ == "__main__":
    # Read command-line parameters.
    dsn = CMBARTER_DSN
    level = 0
    no_cluster = False
    parse_args(sys.argv[1:])

    # See if we should perform a trading turn.
    db = curiousorm.Connection(dsn, dictrows=True)
    should_perform_a_trading_turn = db._lock_solver()  # will block if other process has the lock
    try:
        # "should_perform_a_trading_turn" can be False if the time for
        # the next trading turn has not yet come; or if the solver has
        # not been explicitly unlocked due to a prior server-crash.
        if should_perform_a_trading_turn==True:
            db._prepare_commitments()
            match_commitments(db)
            db._write_deals()
            db._perform_housekeeping()
            db._schedule_notifications()
            db._update_user_limits()
            no_cluster or cluster()
    finally:
        db._unlock_solver()