##// END OF EJS Templates
move ipython command line logic to one place...
move ipython command line logic to one place it keeps getting repeated, more elegant to move it out into the call

File last commit:

r9201:ef712b0b
r11834:1c67772e
Show More
gilsleep.ipynb
60 lines | 1.4 KiB | text/plain | TextLexer
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 {
"metadata": {
"name": "gilsleep"
Brian Granger
Updating a few example notebooks to v3.
r9201 },
"nbformat": 3,
"nbformat_minor": 0,
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 "worksheets": [
{
"cells": [
{
Brian Granger
Updating a few example notebooks to v3.
r9201 "cell_type": "markdown",
"metadata": {},
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 "source": [
Brian Granger
Updating a few example notebooks to v3.
r9201 "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",
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 "The heartbeat will fail after a few iterations prior to fixing Issue [#1260](https://github.com/ipython/ipython/issues/1260)."
]
Brian Granger
Updating a few example notebooks to v3.
r9201 },
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 {
Brian Granger
Updating a few example notebooks to v3.
r9201 "cell_type": "code",
"collapsed": false,
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 "input": [
Brian Granger
Updating a few example notebooks to v3.
r9201 "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",
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 "gilsleep(5)"
Brian Granger
Updating a few example notebooks to v3.
r9201 ],
"language": "python",
"metadata": {},
"outputs": [],
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 "prompt_number": 1
Brian Granger
Updating a few example notebooks to v3.
r9201 },
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 {
Brian Granger
Updating a few example notebooks to v3.
r9201 "cell_type": "code",
"collapsed": true,
"input": [],
"language": "python",
"metadata": {},
"outputs": [],
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 "prompt_number": " "
}
Brian Granger
Updating a few example notebooks to v3.
r9201 ],
"metadata": {}
MinRK
add test notebook and script for #1260 (GIL-related heartbeat failures)...
r5885 }
]
}