Kedro:找不到名为“\uuuu default\uuuu”的管道

2024-05-29 11:53:18 发布

您现在位置:Python中文网/ 问答频道 /正文

和凯德罗有问题。“register_pipelines”函数似乎没有运行或创建我从中返回的默认管道

错误是

(kedro-environment) C:\Users\cc667216\OneDrive\DCS_Pipeline\dcs_files>kedro run
2021-03-22 13:30:28,201 - kedro.framework.session.store - INFO - `read()` not implemented for `BaseSessionStore`. Assuming empty store.
fatal: not a git repository (or any of the parent directories): .git
2021-03-22 13:30:28,447 - kedro.framework.session.session - WARNING - Unable to git describe C:\Users\cc667216\OneDrive\DCS_Pipeline\dcs_files
2021-03-22 13:30:28,476 - root - INFO - ** Kedro project dcs_files
2021-03-22 13:30:28,486 - kedro.framework.session.store - INFO - `save()` not implemented for `BaseSessionStore`. Skipping the step.
Traceback (most recent call last):
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\kedro\framework\context\context.py", line 304, in _get_pipeline
    return pipelines[name]
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\dynaconf\utils\functional.py", line 17, in inner
    return func(self._wrapped, *args)
KeyError: '__default__'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Anaconda3\envs\kedro-environment\Scripts\kedro-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\kedro\framework\cli\cli.py", line 228, in main
    cli_collection(**cli_context)
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\cc667216\OneDrive\DCS_Pipeline\dcs_files\src\dcs_package\cli.py", line 240, in run
    pipeline_name=pipeline,
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\kedro\framework\session\session.py", line 344, in run
    pipeline = context._get_pipeline(name=pipeline_name)
  File "C:\Anaconda3\envs\kedro-environment\lib\site-packages\kedro\framework\context\context.py", line 310, in _get_pipeline
    ) from exc
kedro.framework.context.context.KedroContextError: Failed to find the pipeline named '__default__'. It needs to be generated and returned by the 'register_pipelines' function.

我的src\dcs\u package\pipeline\u registry.py如下所示:

# Copyright 2021 QuantumBlack Visual Analytics Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
# NONINFRINGEMENT. IN NO EVENT WILL THE LICENSOR OR OTHER CONTRIBUTORS
# BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# The QuantumBlack Visual Analytics Limited ("QuantumBlack") name and logo
# (either separately or in combination, "QuantumBlack Trademarks") are
# trademarks of QuantumBlack. The License does not grant you any right or
# license to the QuantumBlack Trademarks. You may not use the QuantumBlack
# Trademarks or any confusingly similar mark as a trademark for your product,
# or use the QuantumBlack Trademarks in any other manner that might cause
# confusion in the marketplace, including but not limited to in advertising,
# on websites, or on software.
#
# See the License for the specific language governing permissions and
# limitations under the License.

"""Project pipelines."""
from typing import Dict
from kedro.pipeline import Pipeline, node
from .pipelines.data_processing.pipeline import create_pipeline
import logging

def register_pipelines() -> Dict[str, Pipeline]:
    """Register the project's pipelines.

    Returns:
        A mapping from a pipeline name to a ``Pipeline`` object.
    """
    log = logging.getLogger(__name__)
    log.info("Start register_pipelines") 
    data_processing_pipeline = create_pipeline()
    log.info("create pipeline done") 
    

    return {
        "__default__": data_processing_pipeline,
        "dp": data_processing_pipeline
    }

然后,我有一个“src\dcs\u package\pipelines\data\u processing\pipeline.py”文件,其中包含一个真正的简单函数,该函数只输出“测试字符串”而不输出其他内容

我能够从我的目录中读取一些项目(csv和xlsx),因此我认为所有依赖项都可以正常工作


Tags: theinpypipelineenvironmentlibpackagesline
2条回答

你在看什么版本的凯德罗?kedro 0.17.2有一点问题,它掩盖了真实错误,并将返回您看到的异常。错误的根本原因可能实际上是其他一些ModuleNotFoundErrorAttributeError。试着在kedro run之前做一个kedro install,看看这是否能解决问题

我在Kedro 0.17.(0~3)中发现,此错误消息的一个原因是pipeline.py中的节点具有更多/更少的输入或输出,而您的节点接受/输出的内容如node.py中所定义。我建议您检查pipeline.py和node.py,以确保两个文件中的输入/输出数量匹配

相关问题 更多 >

    热门问题