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()
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
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()
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
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()
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()