无法使用 dbutils.notebook.run("mynotebook", 3600) 从另一个笔记本运行 databricks 笔记本

问题描述 投票:0回答:1

当我尝试使用 dbutils.notebook.run("mynotebook", 3600) 从另一个 databricks 笔记本运行笔记本时,我收到错误:

com.databricks.WorkflowException: com.databricks.NotebookExecutionException: FAILED: Unable to access the notebook "/Users/[email protected]/path/mynotebooks". Either it does not exist, or the identity used to run this job, xxxxxx ([email protected]), lacks the required permissions.

但是,我可以使用以下命令成功运行笔记本:

%运行“/path/mynotebook”

有人可以告诉我为什么我收到错误提示我没有权限使用 dbutils.notebook.run("mynotebook", 3600) 执行笔记本吗

databricks azure-databricks
1个回答
0
投票

我尝试过以下方法:

dbutils.notebook.run("./child", 3600)

enter image description here

此函数将在新的笔记本上下文中执行指定的笔记本(child),允许您独立于父笔记本运行子笔记本中的代码。

儿童笔记本:

child_variable =  "this is child variable"
dbutils.notebook.exit(child_variable)
  Notebook exited: this is child variable

dbutils.notebook
函数语法如下:

dbutils.notebook.run(notebookpath, timeout_in_seconds, parameters)

dbutils.notebook 函数采用三个参数:

Notebook_path:要执行的目标笔记本的路径。

Timeout_in_seconds: 在引发异常之前允许笔记本运行的最长时间(以秒为单位)。

parameters: JSON 格式的字符串,用于向子笔记本发送参数。参数应指定为键值对,例如 {'parameter1': 'value1', 'parameter2': 'value2'}。

参考: 从 Databricks 中的另一个笔记本调用笔记本

© www.soinside.com 2019 - 2024. All rights reserved.