##// END OF EJS Templates
Merge pull request #2046 from jstenar/iptest-unicode...
Merge pull request #2046 from jstenar/iptest-unicode iptest unicode - fix space in path issue for iptest when using --with-xunit - fix unicode issue in path for iptest closes #760

File last commit:

r6035:3077781f
r7734:bb4488ab merge
Show More
task1.ipynb
117 lines | 2.1 KiB | text/plain | TextLexer
Brian E. Granger
Converting notebooks to JSON format.
r4634 {
Brian Granger
Updating example notebooks to v3 format.
r6035 "metadata": {
"name": "task1"
},
"nbformat": 3,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"source": [
"# Simple task farming example"
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"from IPython.parallel import Client"
],
"language": "python",
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "markdown",
"source": [
"A `Client.load_balanced_view` is used to get the object used for working with load balanced tasks."
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"rc = Client()",
"v = rc.load_balanced_view()"
],
"language": "python",
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "markdown",
"source": [
"Set the variable `d` on all engines:"
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"rc[:]['d'] = 30"
],
"language": "python",
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "markdown",
"source": [
"Define a function that will be our task:"
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"def task(a):",
" return a, 10*d, a*10*d"
],
"language": "python",
"outputs": [],
"prompt_number": 6
},
{
"cell_type": "markdown",
"source": [
"Run the task once:"
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"ar = v.apply(task, 5)"
],
"language": "python",
"outputs": [],
"prompt_number": 7
},
{
"cell_type": "markdown",
"source": [
"Print the results:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print \"a, b, c: \", ar.get()"
],
"language": "python",
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"a, b, c: [5, 300, 1500]"
]
}
],
"prompt_number": 8
}
]
}
]
Brian E. Granger
Converting notebooks to JSON format.
r4634 }