Bump version.

Bump version (hope I found everywhere that it is documented). Fix
old-style print statements in one of the test notebooks.
This commit is contained in:
John Miller 2015-07-04 08:50:53 -05:00
parent 5664274489
commit 127039e2aa
4 changed files with 146 additions and 80 deletions

View file

@ -563,6 +563,11 @@ everything the log buffer. You can reset the patch and log level with
Change Log
==========
v0.7
----
* Support logging in to password protected jupyter servers.
v0.6
----

View file

@ -43,7 +43,7 @@
:group 'applications
:prefix "ein:")
(defvar ein:version "0.3"
(defvar ein:version "0.7"
"Version number for Emacs IPython Notebook (EIN).")

View file

@ -4,9 +4,9 @@
;; Authors: Takafumi Arakaki <aka.tkf at gmail.com>
;; John Miller <millejoh at millejoh.com>
;; URL: http://tkf.github.com/emacs-ipython-notebook/
;; URL: http://millejoh.github.io/emacs-ipython-notebook/
;; Keywords: applications, tools
;; Version: 0.5.0
;; Version: 0.7.0
;; This file is NOT part of GNU Emacs.

View file

@ -2,7 +2,12 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"# Simple interactive bacgkround jobs with IPython\n",
"\n",
@ -11,9 +16,12 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {
"collapsed": false
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [],
"source": [
@ -36,15 +44,20 @@
"def printfunc(interval=1, reps=5):\n",
" for n in range(reps):\n",
" time.sleep(interval)\n",
" print 'In the background...', n\n",
" print('In the background...', n)\n",
" sys.stdout.flush()\n",
" print 'All done!'\n",
" print('All done!')\n",
" sys.stdout.flush()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"Now, we can create a job manager (called simply `jobs`) and use it to submit new jobs.\n",
"\n",
@ -53,27 +66,21 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 4,
"metadata": {
"collapsed": false
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Starting job # 0 in a separate thread.\n",
"Starting job # 2 in a separate thread.\n",
"Starting job # 3 in a separate thread.\n"
]
},
{
"data": {
"text/plain": [
"<BackgroundJob #3: printfunc(1,3)>"
]
},
"execution_count": 10,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
@ -81,10 +88,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"In the background... 0\n",
"In the background... 1\n",
"In the background... 2\n",
"All done!\n"
"Starting job # 0 in a separate thread.\n",
"Starting job # 2 in a separate thread.\n",
"Starting job # 3 in a separate thread.\n"
]
}
],
@ -99,16 +105,24 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"You can check the status of your jobs at any time:"
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 7,
"metadata": {
"collapsed": false
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [
{
@ -116,8 +130,8 @@
"output_type": "stream",
"text": [
"Completed jobs:\n",
"0 : <function sleepfunc at 0x314f848>\n",
"2 : <function sleepfunc at 0x314f848>\n",
"0 : <function sleepfunc at 0x0000000005718F28>\n",
"2 : <function sleepfunc at 0x0000000005718F28>\n",
"3 : printfunc(1,3)\n",
"\n"
]
@ -129,52 +143,62 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"For any completed job, you can get its result easily:"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [
{
"data": {
"text/plain": [
"{'args': (), 'interval': 4, 'kwargs': {}}"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"jobs[0].result"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"## Errors and tracebacks"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"The jobs manager tries to help you with debugging:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 9,
"metadata": {
"collapsed": false
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [
{
@ -195,7 +219,12 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"You can get the traceback of any dead job. Run the line\n",
"below again interactively until it prints a traceback (check the status\n",
@ -204,9 +233,12 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 11,
"metadata": {
"collapsed": false
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [
{
@ -216,12 +248,12 @@
"Status of diejob1: Dead (Exception), call jobs.traceback() for details\n",
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n",
"\u001b[1;31mException\u001b[0m Traceback (most recent call last)\n",
"\u001b[1;32m/home/fperez/usr/opt/virtualenv/ipython-0.13.2/lib/python2.7/site-packages/IPython/lib/backgroundjobs.pyc\u001b[0m in \u001b[0;36mcall\u001b[1;34m(self)\u001b[0m\n",
"\u001b[0;32m 482\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[0;32m 483\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mcall\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32m--> 484\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32mC:\\Users\\millejoh\\Miniconda3\\envs\\py34\\lib\\site-packages\\IPython\\lib\\backgroundjobs.py\u001b[0m in \u001b[0;36mcall\u001b[1;34m(self)\u001b[0m\n",
"\u001b[0;32m 489\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[0;32m 490\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mcall\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32m--> 491\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[0m\n",
"\u001b[1;32m<ipython-input-1-fbbbd0d2a1c3>\u001b[0m in \u001b[0;36mdiefunc\u001b[1;34m(interval, *a, **kw)\u001b[0m\n",
"\u001b[1;32m<ipython-input-3-068d5f1349fc>\u001b[0m in \u001b[0;36mdiefunc\u001b[1;34m(interval, *a, **kw)\u001b[0m\n",
"\u001b[0;32m 13\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mdiefunc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0minterval\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m*\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[0;32m 14\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0minterval\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32m---> 15\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Dead job with interval %s\"\u001b[0m \u001b[1;33m%\u001b[0m \u001b[0minterval\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
@ -233,13 +265,18 @@
}
],
"source": [
"print \"Status of diejob1:\", diejob1.status\n",
"print( \"Status of diejob1:\", diejob1.status)\n",
"diejob1.traceback() # jobs.traceback(4) would also work here, with the job number"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"This will print all tracebacks for all dead jobs:"
]
@ -248,7 +285,10 @@
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [
{
@ -298,16 +338,24 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"The job manager can be flushed of all completed jobs at any time:"
]
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 12,
"metadata": {
"collapsed": false
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [
{
@ -325,16 +373,24 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"After that, the status is simply empty:"
]
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 13,
"metadata": {
"collapsed": true
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [],
"source": [
@ -343,26 +399,26 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"Jobs have a `.join` method that lets you wait on their thread for completion:"
]
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"metadata": {
"collapsed": false
"collapsed": false,
"tags": [
"worksheet-0"
]
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Starting job # 0 in a separate thread.\n"
]
}
],
"outputs": [],
"source": [
"j = jobs.new(sleepfunc, 2)\n",
"j.join?"
@ -370,7 +426,12 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"collapsed": true,
"tags": [
"worksheet-0"
]
},
"source": [
"## Exercise\n",
"\n",
@ -383,4 +444,4 @@
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}
}