【发布时间】:2019-12-04 01:44:58
【问题描述】:
我对 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 显示
参数无值
消息。
我错过了什么?
当我尝试执行管道时,我得到以下信息
D:\python\dag>dagster 管道执行 -f hello_cereal.py -n hello_cereal_pipeline 2019-11-25 14:47:09 - dagster - 调试 - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - PIPELINE_START - 开始执行管道 “hello_cereal_pipeline”。 2019-11-25 14:47:09 - dagster - 调试 - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - ENGINE_EVENT - 执行过程中的步骤 (pid: 11684) event_specific_data = {"metadata_entries": [["pid", null, ["11684"]], ["step_keys", null, ["{'hello_cereal.compute'}"]]]} 2019-11-25 14:47:09 - dagster - 调试 - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - STEP_START - 开始执行 步骤“hello_cereal.compute”。 固体=“你好谷物” solid_definition = "hello_cereal" step_key = "hello_cereal.compute" 2019-11-25 14:47:10 - dagster - 错误 - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - STEP_FAILURE - 执行 步骤“hello_cereal.compute”失败。 cls_name = "FileNotFoundError" 固体=“你好谷物” solid_definition = "hello_cereal" step_key = "hello_cereal.compute"
文件 "c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\errors.py", 第 114 行,在 user_code_error_boundary 产生文件“c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\engine\engine_inprocess.py”, 第 621 行,在 _user_event_sequence_for_step_compute_fn 对于 gen 中的事件:文件“c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\execution\plan\compute.py”, 第 75 行,在 _execute_core_compute 对于_yield_compute_results(compute_context,inputs,compute_fn)中的step_output:文件 "c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\execution\plan\compute.py", 第 52 行,在 _yield_compute_results 中 对于 user_event_sequence 中的事件:文件“c:\users\kirst\appdata\local\programs\python\python38-32\lib\site-packages\dagster\core\definitions\decorators.py”, 第 418 行,在计算中 结果 = fn(context, **kwargs) 文件“hello_cereal.py”,第 10 行,在 hello_cereal 使用 open(dataset_path, 'r') 作为 fd:
2019-11-25 14:47:10 - dagster - 调试 - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - ENGINE_EVENT - 完成的步骤 处理中 (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 - 错误 - hello_cereal_pipeline - 96c575ae-0b7d-49cb-abf4-ce998865ebb3 - PIPELINE_FAILURE - 执行管道“hello_cereal_pipeline” 失败了。
[更新] 从 Rahul 的评论中,我意识到我没有复制整个示例。 当我更正我收到 FileNotFoundError 时
【问题讨论】:
-
你运行了这个例子吗? github.com/dagster-io/dagster/blob/…
-
从代码中我看到有一个
open()调用了一个名为cereal.csv的文件。你能确认一个名为cereal.csv的文件在你运行代码的地方吗?
标签: python-3.x dagster