Skip to content

Commit

Permalink
Fix for colab
Browse files Browse the repository at this point in the history
  • Loading branch information
schustmi committed Aug 6, 2024
1 parent bc10b84 commit 90bff3f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/zenml/utils/notebook_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,14 @@ def get_active_notebook_cell_id() -> str:
Returns:
The ID of the currently active notebook cell.
"""
cell_id = get_ipython().get_parent()["metadata"]["cellId"]
try:
if Environment.in_google_colab():
cell_id = get_ipython().get_parent()["metadata"]["colab"]["cell_id"]
else:
cell_id = get_ipython().get_parent()["metadata"]["cellId"]
except KeyError as e:
logger.warning("Unable to extract cell ID: %s.", str(e))

return cell_id


Expand Down

0 comments on commit 90bff3f

Please sign in to comment.