本文整理汇总了Python中pacemaker.model.meta.Session.flush方法的典型用法代码示例。如果您正苦于以下问题:Python Session.flush方法的具体用法?Python Session.flush怎么用?Python Session.flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pacemaker.model.meta.Session
的用法示例。
在下文中一共展示了Session.flush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_request
# 需要导入模块: from pacemaker.model.meta import Session [as 别名]
# 或者: from pacemaker.model.meta.Session import flush [as 别名]
def create_request(self, options):
"""This is a factory of Request objects.
Creates a Request object with given options plus queue specific
options. Should the options conflict the factory resolves
the conflicts in the way that queue's options have precedence
over given request options.
options: list of tuple (name, value)
"""
# Check if given options are allowed for this Queue object.
allowed = self.get_allowed_options()
LOG.debug("Allowed options: %s" % allowed)
not_allowed = []
for option, _ in options:
if option not in allowed:
not_allowed.append(option)
if not_allowed:
raise QueueError("Given request options are not allowed "
"for this Queue: %s" % ", ".join(not_allowed))
# TODO: create effective options as intersection between
# 'options' and self.options
user_options = [(100, name, value) for name, value in options]
request_options = [(o.priority, o.name, o.value) for o in self.options]
request_options.extend(user_options)
request_options.sort()
request_options = tuple((o[1], o[2]) for o in request_options)
request = Request(request_options)
self.requests.append(request)
Session.flush()
return request