【发布时间】:2021-05-22 07:35:53
【问题描述】:
我在 Databricks 笔记本上尝试了 sys.exit(0)(Python 代码)和 dbutils.notebook.exit()。但是这两个选项都不起作用。 请提出任何其他方法来停止在 Databricks 笔记本中的特定单元格之后执行代码。
【问题讨论】:
-
引发异常?
-
@AlexOtt 我已经尝试过了,但这也行不通。尝试: if(df.shape[0]==0 and df_1.shape[0]==0 and df_2.shape[0]==0): print('Stop the excution here') dbutils.notebook.exit( 'stop') else: pass except: print('ex')
-
dbuilts.notebook.exit()在从另一个笔记本调用笔记本时使用,而不是在交互执行时使用。只需使用raise Exception("exit")代替它... -
@AlexOtt 你能提供代码吗?这会很有帮助。
-
我写的 - 它只是有
raise
标签: azure-databricks