Skip to content

Instantly share code, notes, and snippets.

@minrk
Created August 30, 2021 14:57
Show Gist options
  • Save minrk/10d39c9a84adb379a5edd65bb7c4274e to your computer and use it in GitHub Desktop.
Save minrk/10d39c9a84adb379a5edd65bb7c4274e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"id": "d0dc9268-21a3-4501-a884-072e520a8faa",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using existing profile dir: '/Users/minrk/.ipython/profile_default'\n",
"waiting False running\n",
"Starting 4 engines with <class 'ipyparallel.cluster.launcher.MPIEngineSetLauncher'>\n",
"waiting False running\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "535478ec3adc4fa1b9d79c80d0703d1d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/4 [00:00<?, ?engine/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"error in task (expected): EngineError(Engine 3 died while running task 'e9d2eb18-6099acff559d987377320c1d_1')\n",
"Stopping engine(s): 1630335261\n",
"in stop <ipyparallel.cluster.launcher.MPIEngineSetLauncher object at 0x10b098af0>\n",
"engine set stopped 1630335261: {'exit_code': 11, 'pid': 54331, 'identifier': 'ipengine-1630335261-y7tt-1630335261-54070'}\n",
"mpiexec stopped: pid=54331, exit_code=11\n",
"===================================================================================\n",
"= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES\n",
"= PID 54333 RUNNING AT touchy\n",
"= EXIT CODE: 9\n",
"= CLEANING UP REMAINING PROCESSES\n",
"= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES\n",
"===================================================================================\n",
"Stopping controller\n",
"in stop <ipyparallel.cluster.launcher.LocalControllerLauncher object at 0x10b098b80>\n",
"Controller stopped: {'exit_code': 0, 'pid': 54330, 'identifier': 'ipcontroller-1630335261-y7tt-54070'}\n"
]
}
],
"source": [
"from functools import partial\n",
"import ipyparallel as ipp\n",
"\n",
"\n",
"def crash():\n",
" import ctypes\n",
"\n",
" ctypes.CDLL(None).time(-1)\n",
"\n",
"\n",
"def notice_mpiexec_stopped(stop_info, launcher):\n",
" output = launcher.get_output()\n",
" print(\"mpiexec stopped: pid={pid}, exit_code={exit_code}\".format(**stop_info))\n",
" # extract mpiexec output, which starts with =\n",
" # could also dump the full thing, which is a lot,\n",
" # or tail a number of lines\n",
" for line in output.splitlines(True):\n",
" if line.startswith(\"=\"):\n",
" sys.stdout.write(line)\n",
"\n",
"\n",
"with ipp.Cluster(engine_launcher_class=\"mpi\", n=4) as rc:\n",
" cluster = rc.cluster\n",
" for launcher in cluster.engines.values():\n",
" launcher.on_stop(partial(notice_mpiexec_stopped, launcher=launcher))\n",
" ar = rc[-1].apply_async(crash)\n",
" try:\n",
" ar.get()\n",
" except Exception as e:\n",
" print(f\"error in task (expected): {e}\")"
]
}
],
"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.9.6"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {
"02dce478825549bc805f9ad0e27af9b5": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"layout": "IPY_MODEL_0c52e33c8c5e4c67887b83f3898d0a0a",
"style": "IPY_MODEL_b780700a947146e4a58dd2ed43688598",
"value": "100%"
}
},
"0c52e33c8c5e4c67887b83f3898d0a0a": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"14068d9860104419b399cbdea08ecdd7": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"description_width": ""
}
},
"18a56c457b4d462ebf04c4b5960d7419": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"description_width": ""
}
},
"355fdee552094b7fa4d939be45cab8b5": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "FloatProgressModel",
"state": {
"bar_style": "success",
"layout": "IPY_MODEL_b86fbeb071b8411e8962869cd8630cae",
"max": 4,
"style": "IPY_MODEL_fa5da8f3b83a478c905ff9fa96e79958",
"value": 4
}
},
"370eb3226fc8431dafb1b053c311bdd3": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"description_width": ""
}
},
"3a7f990236ea466fa4026d8635cce469": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"layout": "IPY_MODEL_b6105c60382c4839b3fc46f3457ec768",
"style": "IPY_MODEL_b7ef0d0e853f4ba2b1c0ddced77ae7a5",
"value": " 4/4 [00:03&lt;00:00, 3.74s/engine]"
}
},
"43adb0bf4ba742b182e469b6b3b9ab6f": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"description_width": ""
}
},
"50f2562b00614a769e9a0d72f0d30d13": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"535478ec3adc4fa1b9d79c80d0703d1d": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HBoxModel",
"state": {
"children": [
"IPY_MODEL_02dce478825549bc805f9ad0e27af9b5",
"IPY_MODEL_355fdee552094b7fa4d939be45cab8b5",
"IPY_MODEL_ce30d42520cb4b9d835a5de58cc293f8"
],
"layout": "IPY_MODEL_b8fb1f25941b4d0fbd633a94868fe30c"
}
},
"570b7a42950645bd9a0b183b3f122629": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "FloatProgressModel",
"state": {
"bar_style": "success",
"layout": "IPY_MODEL_8fc28d075ea64bea8e689e64c684a6af",
"max": 4,
"style": "IPY_MODEL_efd487fc173047b38955e84f18bc8051",
"value": 4
}
},
"58e5f7f850584adf93ba8a733673f12a": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "FloatProgressModel",
"state": {
"bar_style": "success",
"layout": "IPY_MODEL_bff6ca4c3f02437f809a03bfed9f397d",
"max": 4,
"style": "IPY_MODEL_73f76a3e709840f788ecbac8999b2e97",
"value": 4
}
},
"58fbc48da4a34e7c96abc05b45b62509": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"layout": "IPY_MODEL_7055bebb26b8456e96edd85ab8be8915",
"style": "IPY_MODEL_5b62f1796074432780b1cb59a405262d",
"value": "100%"
}
},
"5b62f1796074432780b1cb59a405262d": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"description_width": ""
}
},
"5d31c87839a14eaaaa3ee2727d9c15dc": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"64366386603d4a14998a09facc33a4f6": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"7055bebb26b8456e96edd85ab8be8915": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"71cafb45a2794fc9b15d2cb709552564": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ProgressStyleModel",
"state": {
"description_width": ""
}
},
"73f76a3e709840f788ecbac8999b2e97": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ProgressStyleModel",
"state": {
"description_width": ""
}
},
"8fc28d075ea64bea8e689e64c684a6af": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"92f8a55db2bf4b0493eaaffb6e8c4144": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"layout": "IPY_MODEL_d36d09513cb74412992d5d4887dd3960",
"style": "IPY_MODEL_43adb0bf4ba742b182e469b6b3b9ab6f",
"value": " 4/4 [00:03&lt;00:00, 3.99s/engine]"
}
},
"98d1901d683d45e982c48f54dcc41594": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"layout": "IPY_MODEL_f7aa92db8baa49b9ac64864c68534c16",
"style": "IPY_MODEL_370eb3226fc8431dafb1b053c311bdd3",
"value": " 4/4 [00:03&lt;00:00, 3.24s/engine]"
}
},
"ab68cdee2a3a413bba827de5db3715ca": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"b14129a75d7847e6a1d75b5ec0c4c4e4": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"b6105c60382c4839b3fc46f3457ec768": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"b780700a947146e4a58dd2ed43688598": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"description_width": ""
}
},
"b7ef0d0e853f4ba2b1c0ddced77ae7a5": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"description_width": ""
}
},
"b86fbeb071b8411e8962869cd8630cae": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"b8fb1f25941b4d0fbd633a94868fe30c": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"bb0a8472356f4f6db4f0931b5f705902": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HBoxModel",
"state": {
"children": [
"IPY_MODEL_e64210e22807415d87a2d3750086d86f",
"IPY_MODEL_570b7a42950645bd9a0b183b3f122629",
"IPY_MODEL_92f8a55db2bf4b0493eaaffb6e8c4144"
],
"layout": "IPY_MODEL_ab68cdee2a3a413bba827de5db3715ca"
}
},
"bff6ca4c3f02437f809a03bfed9f397d": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"ce30d42520cb4b9d835a5de58cc293f8": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"layout": "IPY_MODEL_b14129a75d7847e6a1d75b5ec0c4c4e4",
"style": "IPY_MODEL_e6abadd45f9d4b8596fdf10c13d0ebc1",
"value": " 4/4 [00:03&lt;00:00, 1.41engine/s]"
}
},
"d12bcb37805d44a78903b50889b24a11": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"layout": "IPY_MODEL_e3ef86bcddcb49a38f5001b83bf4baa3",
"style": "IPY_MODEL_18a56c457b4d462ebf04c4b5960d7419",
"value": "100%"
}
},
"d36d09513cb74412992d5d4887dd3960": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"d544e214f0164ce08d6e205ab442c6d8": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "FloatProgressModel",
"state": {
"bar_style": "success",
"layout": "IPY_MODEL_64366386603d4a14998a09facc33a4f6",
"max": 4,
"style": "IPY_MODEL_71cafb45a2794fc9b15d2cb709552564",
"value": 4
}
},
"e3ef86bcddcb49a38f5001b83bf4baa3": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"e64210e22807415d87a2d3750086d86f": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"layout": "IPY_MODEL_5d31c87839a14eaaaa3ee2727d9c15dc",
"style": "IPY_MODEL_14068d9860104419b399cbdea08ecdd7",
"value": "100%"
}
},
"e6abadd45f9d4b8596fdf10c13d0ebc1": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"description_width": ""
}
},
"e773bdbb5eca4fe39638e3f2c967b5e5": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"efd487fc173047b38955e84f18bc8051": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ProgressStyleModel",
"state": {
"description_width": ""
}
},
"f5634c3789c84a26ba5338f83e670b7f": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HBoxModel",
"state": {
"children": [
"IPY_MODEL_d12bcb37805d44a78903b50889b24a11",
"IPY_MODEL_d544e214f0164ce08d6e205ab442c6d8",
"IPY_MODEL_3a7f990236ea466fa4026d8635cce469"
],
"layout": "IPY_MODEL_e773bdbb5eca4fe39638e3f2c967b5e5"
}
},
"f7aa92db8baa49b9ac64864c68534c16": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"fa1748832a3c4516b7a6165372671f0f": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HBoxModel",
"state": {
"children": [
"IPY_MODEL_58fbc48da4a34e7c96abc05b45b62509",
"IPY_MODEL_58e5f7f850584adf93ba8a733673f12a",
"IPY_MODEL_98d1901d683d45e982c48f54dcc41594"
],
"layout": "IPY_MODEL_50f2562b00614a769e9a0d72f0d30d13"
}
},
"fa5da8f3b83a478c905ff9fa96e79958": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ProgressStyleModel",
"state": {
"description_width": ""
}
}
},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment