当前位置: 首页>>代码示例>>Python>>正文


Python UnitOfWorkDao.run_query方法代码示例

本文整理汇总了Python中synergy.db.dao.unit_of_work_dao.UnitOfWorkDao.run_query方法的典型用法代码示例。如果您正苦于以下问题:Python UnitOfWorkDao.run_query方法的具体用法?Python UnitOfWorkDao.run_query怎么用?Python UnitOfWorkDao.run_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在synergy.db.dao.unit_of_work_dao.UnitOfWorkDao的用法示例。


在下文中一共展示了UnitOfWorkDao.run_query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: FreerunStatements

# 需要导入模块: from synergy.db.dao.unit_of_work_dao import UnitOfWorkDao [as 别名]
# 或者: from synergy.db.dao.unit_of_work_dao.UnitOfWorkDao import run_query [as 别名]
class FreerunStatements(object):
    def __init__(self, logger, freerun_handlers):
        self.lock = RLock()
        self.logger = logger
        self.freerun_handlers = freerun_handlers
        self.uow_dao = UnitOfWorkDao(self.logger)

    @thread_safe
    def retrieve_records(self, timeperiod, include_running,
                         include_processed, include_noop, include_failed, include_disabled):
        """ method looks for suitable UOW records and returns them as a dict"""
        resp = dict()
        try:
            query = unit_of_work_dao.QUERY_GET_FREERUN_SINCE(timeperiod, include_running,
                                                             include_processed, include_noop, include_failed)
            records_list = self.uow_dao.run_query(query)
            if len(records_list) == 0:
                self.logger.warning('MX: no Freerun UOW records found since {0}.'.format(timeperiod))

            for uow_record in records_list:
                if uow_record.process_name not in self.freerun_handlers:
                    continue

                thread_handler = self.freerun_handlers[uow_record.process_name]
                if not include_disabled and not thread_handler.process_entry.is_on:
                    continue

                resp[uow_record.key] = uow_record.document
        except Exception as e:
            self.logger.error('MX Dashboard FreerunStatements error: {0}'.format(e))
        return resp
开发者ID:xiaohuangji,项目名称:scheduler,代码行数:33,代码来源:dashboard_handler.py

示例2: FreerunStatements

# 需要导入模块: from synergy.db.dao.unit_of_work_dao import UnitOfWorkDao [as 别名]
# 或者: from synergy.db.dao.unit_of_work_dao.UnitOfWorkDao import run_query [as 别名]
class FreerunStatements(object):
    def __init__(self, logger):
        self.lock = RLock()
        self.logger = logger
        self.uow_dao = UnitOfWorkDao(self.logger)

    @thread_safe
    def retrieve_records(self, timeperiod, unprocessed_only):
        """ method looks for suitable UOW records and returns them as a dict"""
        resp = dict()
        try:
            query = unit_of_work_dao.QUERY_GET_FREERUN_SINCE(timeperiod, unprocessed_only)
            records_list = self.uow_dao.run_query(query)
            if len(records_list) == 0:
                self.logger.warn('No Freerun UOW records found since {0}.'.format(timeperiod))

            for uow_record in records_list:
                resp[uow_record.key] = uow_record.document
        except Exception as e:
            self.logger.error('DashboardHandler error: {0}'.format(e))
        return resp
开发者ID:eggsandbeer,项目名称:scheduler,代码行数:23,代码来源:dashboard_handler.py


注:本文中的synergy.db.dao.unit_of_work_dao.UnitOfWorkDao.run_query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。