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


Python Name.get_instance_prefix方法代码示例

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


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

示例1: _get_instance_using_cache

# 需要导入模块: from pinball.workflow.name import Name [as 别名]
# 或者: from pinball.workflow.name.Name import get_instance_prefix [as 别名]
    def _get_instance_using_cache(self, workflow, instance):
        """Get workflow instance, preferably from the cache.

        As a side effect, if the instance is archived and it does not exist in
        the cache, it will be added to the cache.

        Args:
            workflow: The name of the workflow whose instance we are
                interested in.
            instance: The instance we are interested in.
        Returns:
            The workflow instance or None if it was not found.
        """
        name = Name(workflow=workflow, instance=instance)
        instance_prefix = name.get_instance_prefix()
        data = self._store.get_cached_data(instance_prefix)
        if data:
            instance_data = pickle.loads(data)
        else:
            # Cache only archived instances.
            if self._store.read_archived_token_names(
                    name_prefix=instance_prefix):
                # The ordering of operations is important.  We need to make
                # sure that we add to the cache instance data constructed from
                # the archived tokens.
                instance_data = self._get_instance_no_cache(workflow, instance)
                self._store.set_cached_data(instance_prefix,
                                            pickle.dumps(instance_data))
            else:
                instance_data = self._get_instance_no_cache(workflow, instance)
        return instance_data
开发者ID:Betterment,项目名称:pinball,代码行数:33,代码来源:data_builder.py

示例2: _read_tokens_from_store

# 需要导入模块: from pinball.workflow.name import Name [as 别名]
# 或者: from pinball.workflow.name.Name import get_instance_prefix [as 别名]
    def _read_tokens_from_store(self, store):
        """Read archived job tokens from the store.

        Args:
            store: The store to read tokens from.
        """
        name = Name(workflow=self._workflow, instance=self._instance)
        tokens = store.read_archived_tokens(
            name_prefix=name.get_instance_prefix())
        self._filter_job_tokens(tokens)
开发者ID:cafyne,项目名称:pinball,代码行数:12,代码来源:analyzer.py

示例3: _get_instance_tokens

# 需要导入模块: from pinball.workflow.name import Name [as 别名]
# 或者: from pinball.workflow.name.Name import get_instance_prefix [as 别名]
    def _get_instance_tokens(self):
        """Retrieve all workflow instance tokens.

        Returns:
            List of tokens in the workflow instance.
        """
        prefix = Name(workflow=self._workflow, instance=self._instance)
        query = Query(namePrefix=prefix.get_instance_prefix())
        query_request = QueryRequest(queries=[query])
        try:
            query_response = self._client.query(query_request)
        except TokenMasterException:
            LOG.exception("error sending request %s", query_request)
            return None
        if not query_response.tokens:
            return None
        assert len(query_response.tokens) == 1
        return query_response.tokens[0]
开发者ID:cafyne,项目名称:pinball,代码行数:20,代码来源:archiver.py


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