##// END OF EJS Templates
add kernel metadata to example notebooks
add kernel metadata to example notebooks

File last commit:

r20278:8f4dcac7
r20278:8f4dcac7
Show More
gilsleep.ipynb
72 lines | 1.6 KiB | text/plain | TextLexer
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 {
Min RK
add kernel metadata to example notebooks
r20278 "cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Holding the GIL for too long could disrupt the heartbeat due to non-copying sends.\n",
"\n",
"The following cell repeatedly calls a function that holds the GIL for five seconds.\n",
"\n",
"The heartbeat will fail after a few iterations prior to fixing Issue [#1260](https://github.com/ipython/ipython/issues/1260)."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import sys\n",
"import time\n",
"\n",
"from cython import inline\n",
"\n",
"def gilsleep(t):\n",
" \"\"\"gil-holding sleep with cython.inline\"\"\"\n",
" code = '\\n'.join([\n",
" 'from posix cimport unistd',\n",
" 'unistd.sleep(t)',\n",
" ])\n",
" while True:\n",
" inline(code, quiet=True, t=t)\n",
" print time.time()\n",
" sys.stdout.flush() # this is important\n",
"\n",
"gilsleep(5)"
]
},
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 {
Min RK
add kernel metadata to example notebooks
r20278 "cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 }
Min RK
add kernel metadata to example notebooks
r20278 ],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.4.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}