Skip to content

Instantly share code, notes, and snippets.

@fomightez
Created June 25, 2024 17:36
Show Gist options
  • Save fomightez/7e08ac5326ddd4dcb54515aa24019212 to your computer and use it in GitHub Desktop.
Save fomightez/7e08ac5326ddd4dcb54515aa24019212 to your computer and use it in GitHub Desktop.
For SO 78668628/8508004 6-25-2024 https://stackoverflow.com/q/78668628/8508004 testing error handling of jupytext and papermill
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "740642ee",
"metadata": {
"tags": [
"papermill-error-cell-tag"
]
},
"source": [
"<span style=\"color:red; font-family:Helvetica Neue, Helvetica, Arial, sans-serif; font-size:2em;\">An Exception was encountered at '<a href=\"#papermill-error-cell\">In [2]</a>'.</span>"
]
},
{
"cell_type": "markdown",
"id": "32b8d7b7-9001-4ece-b4e2-0cf25f0380b8",
"metadata": {
"papermill": {
"duration": 0.007484,
"end_time": "2024-06-25T17:31:54.601214",
"exception": false,
"start_time": "2024-06-25T17:31:54.593730",
"status": "completed"
},
"tags": []
},
"source": [
"test error handling when running on command line + API per time delay\n",
"https://stackoverflow.com/q/78668628/8508004\n",
"https://discourse.jupyter.org/t/auto-save-periodically-during-nbconvert/17361/2?u=fomightez\n",
"https://discourse.jupyter.org/t/run-ipynb-on-a-remote-workstation-so-that-all-results-will-be-save-in-the-same-pynb/13340/2?u=fomightez\n",
"[save every second](https://stackoverflow.com/a/75316929/8508004) using api"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "86dc87e8-0af7-4361-bdbc-24909f5163d2",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-25T17:31:54.615461Z",
"iopub.status.busy": "2024-06-25T17:31:54.614211Z",
"iopub.status.idle": "2024-06-25T17:31:54.638779Z",
"shell.execute_reply": "2024-06-25T17:31:54.637761Z"
},
"papermill": {
"duration": 0.037438,
"end_time": "2024-06-25T17:31:54.644545",
"exception": false,
"start_time": "2024-06-25T17:31:54.607107",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4\n"
]
}
],
"source": [
"print(2+2)"
]
},
{
"cell_type": "markdown",
"id": "c98a4c8a",
"metadata": {
"tags": [
"papermill-error-cell-tag"
]
},
"source": [
"<span id=\"papermill-error-cell\" style=\"color:red; font-family:Helvetica Neue, Helvetica, Arial, sans-serif; font-size:2em;\">Execution using papermill encountered an exception here and stopped:</span>"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "ea74f9b8-36da-49b4-89ed-c8661f21756a",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-25T17:31:54.657121Z",
"iopub.status.busy": "2024-06-25T17:31:54.656339Z",
"iopub.status.idle": "2024-06-25T17:31:54.667161Z",
"shell.execute_reply": "2024-06-25T17:31:54.664718Z"
},
"papermill": {
"duration": 0.021321,
"end_time": "2024-06-25T17:31:54.671564",
"exception": true,
"start_time": "2024-06-25T17:31:54.650243",
"status": "failed"
},
"tags": []
},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "incomplete input (149104261.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Cell \u001b[0;32mIn [2], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m print(\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m incomplete input\n"
]
}
],
"source": [
"print("
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "75318954-6b23-4887-b405-36d5314bd061",
"metadata": {
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"outputs": [],
"source": [
"4 + 4"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "efad4c1a-9d48-4797-afc8-cfa3c10c3f3d",
"metadata": {
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"outputs": [],
"source": [
"5 +5"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"papermill": {
"default_parameters": {},
"duration": 2.644664,
"end_time": "2024-06-25T17:31:55.004077",
"environment_variables": {},
"exception": true,
"input_path": "test_error_handling.ipynb",
"output_path": "pm.ipynb",
"parameters": {},
"start_time": "2024-06-25T17:31:52.359413",
"version": "2.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment