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


Python Session.flush方法代码示例

本文整理汇总了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
开发者ID:rojkov,项目名称:pacemaker,代码行数:36,代码来源:__init__.py


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