menotron
Valued Contributor

You can use the dbutils.notebook.exit("returnValue") as explained here stop execution of a notebook gracefully.

 

if condition:
  pass
else:
  dbutils.notebook.exit("Aborting as ondition not met. Further tasks will be skipped")