Skip to content

Commit

Permalink
Catch asyncio TimeoutError when trying to update papermill metadata (#…
Browse files Browse the repository at this point in the history
…102)

* Catch asyncio TimeoutError when trying to update papermill metadata

* update changelog

* Bump version: 0.0.17 → 0.0.18
  • Loading branch information
rohitsanj authored Dec 19, 2022
1 parent cdb999d commit 764dbcd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.0.17
current_version = 0.0.18
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize =
{major}.{minor}.{patch}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.0.18] - 2021-12-19
### Changed
- Catch asyncio.exceptions.TimeoutError when updating notebook metadata over RTU

## [0.0.17] - 2022-12-16
### Changed
- Catch all HTTPStatusErrors when trying to delete the kernel session after successful execution
Expand Down
2 changes: 1 addition & 1 deletion papermill_origami/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.0.17"
version = "0.0.18"
16 changes: 12 additions & 4 deletions papermill_origami/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@ async def sync_noteable_nb_metadata_with_papermill(self):
for key, value in flatten_dict(
self.nb.metadata.papermill, parent_key_tuple=("papermill",)
).items():
await self.km.client.update_nb_metadata(self.file, {"path": key, "value": value})
try:
await self.km.client.update_nb_metadata(self.file, {"path": key, "value": value})
except asyncio.exceptions.TimeoutError:
logger.debug("Timeout error while updating notebook metadata")
pass

@staticmethod
def create_kernel_manager(file: NotebookFile, client: NoteableClient, **kwargs):
Expand Down Expand Up @@ -358,9 +362,13 @@ def _cell_start(self, cell, cell_index=None, **kwargs):
def _cell_exception(self, cell, cell_index=None, **kwargs):
self.catch_cell_metadata_updates(self.nb_man.cell_exception)(cell, cell_index, **kwargs)
# Manually update the Noteable nb metadata
run_sync(self.km.client.update_nb_metadata)(
self.file, {"path": ["papermill", "exception"], "value": True}
)
try:
run_sync(self.km.client.update_nb_metadata)(
self.file, {"path": ["papermill", "exception"], "value": True}
)
except asyncio.exceptions.TimeoutError:
logger.debug("Timeout error while updating notebook metadata")
pass

def _cell_complete(self, cell, cell_index=None, **kwargs):
self.catch_cell_metadata_updates(self.nb_man.cell_complete)(cell, cell_index, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[tool.poetry]
name = "papermill-origami"
version = "0.0.17"
version = "0.0.18"
description = "The noteable API interface"
authors = ["Matt Seal <[email protected]>"]
maintainers = ["Matt Seal <[email protected]>"]
Expand Down

0 comments on commit 764dbcd

Please sign in to comment.