##// END OF EJS Templates
Open 0.13 series for development.
Open 0.13 series for development.

File last commit:

r4910:0dc49390
r5796:d8d30d78
Show More
helloworld.ipynb
64 lines | 2.5 KiB | text/plain | TextLexer
Brian E. Granger
Converting notebooks to JSON format.
r4634 {
"nbformat": 2,
Brian E. Granger
Implemented metadata for notebook format.
r4637 "metadata": {
"name": "helloworld"
},
Brian E. Granger
Converting notebooks to JSON format.
r4634 "worksheets": [
{
"cells": [
{
"source": "# Distributed hello world\n\nOriginally by Ken Kinder (ken at kenkinder dom com)",
"cell_type": "markdown"
},
{
"cell_type": "code",
"language": "python",
"outputs": [],
"collapsed": true,
"prompt_number": 3,
"input": "from IPython.parallel import Client"
},
{
"cell_type": "code",
"language": "python",
"outputs": [],
"collapsed": true,
"prompt_number": 4,
"input": "rc = Client()\nview = rc.load_balanced_view()"
},
{
"cell_type": "code",
"language": "python",
"outputs": [],
"collapsed": true,
"prompt_number": 5,
"input": "def sleep_and_echo(t, msg):\n import time\n time.sleep(t)\n return msg"
},
{
"cell_type": "code",
"language": "python",
"outputs": [],
"collapsed": true,
"prompt_number": 6,
"input": "world = view.apply_async(sleep_and_echo, 3, 'World!')\nhello = view.apply_async(sleep_and_echo, 2, 'Hello')\n"
},
{
"cell_type": "code",
"language": "python",
"outputs": [
{
"output_type": "stream",
"text": "Submitted tasks: ['9e533683-d54e-4588-929e-984dd3eb6dc4'] ['90395f15-723f-44df-a743-a5d88cdeb6a0']\nHello"
},
{
"output_type": "stream",
"text": "World!"
}
],
"collapsed": false,
"prompt_number": 7,
"input": "print \"Submitted tasks:\", hello.msg_ids, world.msg_ids\nprint hello.get(), world.get()"
}
]
}
]
}