示例#1
0
def run(agent_id, force=False):
    """Runs the livesync agent"""
    update_session_options(db)
    if agent_id is None:
        agent_list = LiveSyncAgent.find_all()
    else:
        agent = LiveSyncAgent.find_first(id=int(agent_id))
        if agent is None:
            print 'No such agent'
            return
        agent_list = [agent]

    for agent in agent_list:
        if agent.backend is None:
            print cformat(
                'Skipping agent: %{red!}{}%{reset} (backend not found)'
            ).format(agent.name)
            continue
        if not agent.initial_data_exported and not force:
            print cformat(
                'Skipping agent: %{red!}{}%{reset} (initial export not performed)'
            ).format(agent.name)
            continue
        print cformat('Running agent: %{white!}{}%{reset}').format(agent.name)
        with DBMgr.getInstance().global_connection():
            try:
                agent.create_backend().run()
                db.session.commit()
            finally:
                transaction.abort()
示例#2
0
def run(agent_id, force=False):
    """Runs the livesync agent"""
    if agent_id is None:
        agent_list = LiveSyncAgent.find_all()
    else:
        agent = LiveSyncAgent.find_first(id=agent_id)
        if agent is None:
            print 'No such agent'
            return
        agent_list = [agent]

    for agent in agent_list:
        if agent.backend is None:
            print cformat('Skipping agent: %{red!}{}%{reset} (backend not found)').format(agent.name)
            continue
        if not agent.initial_data_exported and not force:
            print cformat('Skipping agent: %{red!}{}%{reset} (initial export not performed)').format(agent.name)
            continue
        print cformat('Running agent: %{white!}{}%{reset}').format(agent.name)
        try:
            agent.create_backend().run()
            db.session.commit()
        except:
            db.session.rollback()
            raise
示例#3
0
def run(agent_id, force=False):
    """Runs the livesync agent"""
    update_session_options(db)
    if agent_id is None:
        agent_list = LiveSyncAgent.find_all()
    else:
        agent = LiveSyncAgent.find_first(id=int(agent_id))
        if agent is None:
            print 'No such agent'
            return
        agent_list = [agent]

    for agent in agent_list:
        if agent.backend is None:
            print cformat('Skipping agent: %{red!}{}%{reset} (backend not found)').format(agent.name)
            continue
        if not agent.initial_data_exported and not force:
            print cformat('Skipping agent: %{red!}{}%{reset} (initial export not performed)').format(agent.name)
            continue
        print cformat('Running agent: %{white!}{}%{reset}').format(agent.name)
        with DBMgr.getInstance().global_connection():
            try:
                agent.create_backend().run()
                db.session.commit()
            finally:
                transaction.abort()
示例#4
0
def run(agent_id, force=False):
    """Runs the livesync agent"""
    if agent_id is None:
        agent_list = LiveSyncAgent.find_all()
    else:
        agent = LiveSyncAgent.find_first(id=agent_id)
        if agent is None:
            print 'No such agent'
            return
        agent_list = [agent]

    for agent in agent_list:
        if agent.backend is None:
            print cformat(
                'Skipping agent: %{red!}{}%{reset} (backend not found)'
            ).format(agent.name)
            continue
        if not agent.initial_data_exported and not force:
            print cformat(
                'Skipping agent: %{red!}{}%{reset} (initial export not performed)'
            ).format(agent.name)
            continue
        print cformat('Running agent: %{white!}{}%{reset}').format(agent.name)
        try:
            agent.create_backend().run()
            db.session.commit()
        except:
            db.session.rollback()
            raise
示例#5
0
def scheduled_update():
    from indico_livesync.plugin import LiveSyncPlugin
    clean_old_entries()
    for agent in LiveSyncAgent.find_all():
        if agent.backend is None:
            LiveSyncPlugin.logger.warning('Skipping agent %s; backend not found', agent.name)
            continue
        if not agent.initial_data_exported:
            LiveSyncPlugin.logger.warning('Skipping agent %s; initial export not performed yet', agent.name)
            continue
        LiveSyncPlugin.logger.info('Running agent %s', agent.name)
        agent.create_backend().run()
        db.session.commit()
示例#6
0
def scheduled_update():
    from indico_livesync.plugin import LiveSyncPlugin
    clean_old_entries()
    for agent in LiveSyncAgent.find_all():
        if agent.backend is None:
            LiveSyncPlugin.logger.warning(
                'Skipping agent %s; backend not found', agent.name)
            continue
        if not agent.initial_data_exported:
            LiveSyncPlugin.logger.warning(
                'Skipping agent %s; initial export not performed yet',
                agent.name)
            continue
        LiveSyncPlugin.logger.info('Running agent %s', agent.name)
        agent.create_backend().run()
        db.session.commit()