函数调用中的参数没有值

No value for arguement in function call

我是 Python 的新手,正在研究 Dagster hello tutorial

我已经根据教程设置了以下内容

import csv

from dagster import execute_pipeline, execute_solid, pipeline, solid


@solid
def hello_cereal(context):
    # Assuming the dataset is in the same directory as this file
    dataset_path = 'cereal.csv'
    with open(dataset_path, 'r') as fd:
        # Read the rows in using the standard csv library
        cereals = [row for row in csv.DictReader(fd)]

    context.log.info(
        'Found {n_cereals} cereals'.format(n_cereals=len(cereals))
    )

    return cereals


@pipeline
def hello_cereal_pipeline():
    hello_cereal()

然而 pylint 显示

a no value for parameter

留言。

我错过了什么?

当我尝试执行管道时,我得到以下信息

D:\python\dag>dagster pipeline execute -f hello_cereal.py -n hello_cereal_pipeline 2019-11-25 14:47:09 - dagster - DEBUG - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - PIPELINE_START - Started execution of pipeline "hello_cereal_pipeline". 2019-11-25 14:47:09 - dagster - DEBUG - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - ENGINE_EVENT - Executing steps in process (pid: 11684) event_specific_data = {"metadata_entries": [["pid", null, ["11684"]], ["step_keys", null, ["{'hello_cereal.compute'}"]]]} 2019-11-25 14:47:09 - dagster - DEBUG - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - STEP_START - Started execution of step "hello_cereal.compute". solid = "hello_cereal" solid_definition = "hello_cereal" step_key = "hello_cereal.compute" 2019-11-25 14:47:10 - dagster - ERROR - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - STEP_FAILURE - Execution of step "hello_cereal.compute" failed. cls_name = "FileNotFoundError" solid = "hello_cereal" solid_definition = "hello_cereal" step_key = "hello_cereal.compute"

File "c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\errors.py", line 114, in user_code_error_boundary yield File "c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\engine\engine_inprocess.py", line 621, in _user_event_sequence_for_step_compute_fn for event in gen: File "c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\execution\plan\compute.py", line 75, in _execute_core_compute for step_output in _yield_compute_results(compute_context, inputs, compute_fn): File "c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\execution\plan\compute.py", line 52, in _yield_compute_results for event in user_event_sequence: File "c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\definitions\decorators.py", line 418, in compute result = fn(context, **kwargs) File "hello_cereal.py", line 10, in hello_cereal with open(dataset_path, 'r') as fd:

2019-11-25 14:47:10 - dagster - DEBUG - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - ENGINE_EVENT - Finished steps in process (pid: 11684) in 183ms event_specific_data = {"metadata_entries": [["pid", null, ["11684"]], ["step_keys", null, ["{'hello_cereal.compute'}"]]]} 2019-11-25 14:47:10 - dagster - ERROR - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - PIPELINE_FAILURE - Execution of pipeline "hello_cereal_pipeline" failed.

[更新] 从 Rahul 的评论中,我意识到我没有复制整个示例。 当我更正我得到一个 FileNotFoundError

请检查您使用的数据集(csv文件)是否与您的代码文件在同一目录下。这可能就是为什么你得到

FileNotFoundError error

回答有关您为何收到 "no value for parameter" pylint 消息的原始问题 -

这是因为管道函数调用在构造函数中不包含任何参数,而 @solid 函数已定义参数。这是 dagster 有意为之的,可以通过在模块开头或带有 pylint 消息的行的右侧添加以下行来忽略。请注意,将 python 注释放在模块开头下方会告诉 pylint 忽略模块中的任何警告实例,而将注释放在行内则告诉 pylint 仅忽略该警告实例。

# pylint: disable=no-value-for-parameter 

最后,您也可以在 .pylintrc 文件中放置类似的忽略语句,但我建议不要这样做,因为那将是项目全局的,您可能会错过真正的问题。

希望对您有所帮助!