本文整理汇总了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
示例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