本文整理匯總了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