示例#1
0
def start_daemon(step):
    db_manager = dbmanager.DBManager(world.config['connections']['mysql'],
                                     autoflush=False)
    db = db_manager.get_db()
    try:
        CRATIO = 120
        where = and_(
            db.messages.status == 0, db.messages.type == 'out',
            db.messages.message_version == 2, db.messages.message != '',
            db.messages.message != None,
            func.unix_timestamp(db.messages.dtlasthandleattempt) +
            db.messages.handle_attempts * CRATIO < func.unix_timestamp(
                func.now()))
        msgs = db.messages.filter(where).order_by(desc(db.messages.id)).all()

        world.right_msgs = [
            msg.messageid for msg in msgs if msg.message_name != 'ExecScript'
        ]

        assert len(world.right_msgs) != 0

        config = ETC_DIR + '/config.yml'
        assert lib.start_daemon('msg_sender', config)
    finally:
        db.session.remove()
示例#2
0
文件: steps.py 项目: AnyBucket/scalr
def start_daemon(step):
    db_manager = dbmanager.DBManager(world.config['connections']['mysql'], autoflush=False)
    db = db_manager.get_db()
    try:
        CRATIO = 120
        where = and_(db.messages.status == 0, db.messages.type == 'out',
                db.messages.message_version == 2,
                db.messages.message != '',
                db.messages.message != None,
                func.unix_timestamp(db.messages.dtlasthandleattempt) +
                db.messages.handle_attempts * CRATIO < func.unix_timestamp(func.now()))
        msgs = db.messages.filter(where).order_by(desc(db.messages.id)).all()

        world.right_msgs = [
                msg.messageid for msg in msgs if msg.message_name != 'ExecScript']

        assert len(world.right_msgs) != 0

        config = ETC_DIR + '/config.yml'
        assert lib.start_daemon('msg_sender', config)
    finally:
        db.session.remove()
示例#3
0
文件: steps.py 项目: alisheikh/scalr
def start_daemon(step, name):
    config = ETC_DIR + '/config.yml'
    assert lib.start_daemon(name, config)
示例#4
0
文件: steps.py 项目: AsherBond/scalr
def start_daemon(step, name):
    config = ETC_DIR + '/config.yml'
    assert lib.start_daemon(name, config)