我们在Databricks中定义了一个PythonScriptStep()。在管道脚本中使用PythonScriptStep()时,我们无法找到scoring.py文件。
scoring_step = PythonScriptStep(
name="Scoring_Step",
source_directory=os.getenv("DATABRICKS_NOTEBOOK_PATH", "/Users/USER_NAME/source_directory"),
script_name="./scoring.py",
arguments=["--input_dataset", ds_consumption],
compute_target=pipeline_cluster,
runconfig=pipeline_run_config,
allow_reuse=False)我们得到以下错误消息:
Step [Scoring_Step]: script not found at: /databricks/driver/scoring.py. Make sure to specify an appropriate source_directory on the Step or default_source_directory on the Pipeline.出于某种原因,Databricks正在搜索'/databricks/driver/‘中的文件,而不是我们输入的文件夹。
还有一种使用DatabricksStep()而不是PythonScriptStep()的方法,但是由于特定的原因,我们需要使用PythonSriptStep()类。
有人能帮我们解决这个具体问题吗?
非常感谢您的帮助!
发布于 2022-06-27 10:12:54
scoring_step = PythonScriptStep(
name="Scoring_Step",
source_directory=os.getenv("DATABRICKS_NOTEBOOK_PATH", "/Users/USER_NAME/source_directory"),
script_name="./scoring.py",
arguments=["--input_dataset", ds_consumption],
compute_target=pipeline_cluster,
runconfig=pipeline_run_config,
allow_reuse=False)用下面的代码块更改上面的代码块。它将解决错误。
data_ref = OutputFileDatasetConfig(
name='data_ref',
destination=(ds, '/data')
).as_upload()
data_prep_step = PythonScriptStep(
name='data_prep',
script_name='pipeline_steps/data_prep.py',
source_directory='/.',
arguments=[
'--main_path', main_ref,
'--data_ref_folder', data_ref
],
inputs=[main_ref, data_ref],
outputs=[data_ref],
runconfig=arbitrary_run_config,
allow_reuse=False
)文档的参考链接
https://stackoverflow.com/questions/72732616
复制相似问题