jerryrard
jerryrard

Reputation: 1

Databricks Python run all cells in another notebook except the last

I have a Python Databricks notebook which I want to call/run another Databricks notebook using dbutils.notebook.run()... but I want to run all the cells in the "called" notebook except the last one.

Is there a way to do a count of cells in the called notebook? And then run the called notebook on all cells until CellCount-1 ?

dbutils.notebook.run(notebook_path)

Upvotes: 0

Views: 55

Answers (1)

Chen Hirsh
Chen Hirsh

Reputation: 1400

To stop running a child notebook at a certain cell, add a cell before with this code:

dbutils.notebook.exit("success")

This will exit the child notebook at this point and return to the parent notebook.

Upvotes: 0

Related Questions