##// END OF EJS Templates
add Client.spin_thread()...
add Client.spin_thread() runs Client.spin() in a background thread at a set interval

File last commit:

r6035:3077781f
r6484:472cd248
Show More
taskmap.ipynb
108 lines | 2.6 KiB | text/plain | TextLexer
Brian E. Granger
Converting notebooks to JSON format.
r4634 {
MinRK
regenerate example notebooks to remove transformed output
r5981 "metadata": {
"name": "taskmap"
Brian Granger
Updating example notebooks to v3 format.
r6035 },
"nbformat": 3,
MinRK
regenerate example notebooks to remove transformed output
r5981 "worksheets": [
{
"cells": [
{
Brian Granger
Updating example notebooks to v3 format.
r6035 "cell_type": "markdown",
MinRK
regenerate example notebooks to remove transformed output
r5981 "source": [
"# Load balanced map and parallel function decorator"
]
Brian Granger
Updating example notebooks to v3 format.
r6035 },
MinRK
regenerate example notebooks to remove transformed output
r5981 {
Brian Granger
Updating example notebooks to v3 format.
r6035 "cell_type": "code",
"collapsed": true,
MinRK
regenerate example notebooks to remove transformed output
r5981 "input": [
"from IPython.parallel import Client"
Brian Granger
Updating example notebooks to v3 format.
r6035 ],
"language": "python",
"outputs": [],
MinRK
regenerate example notebooks to remove transformed output
r5981 "prompt_number": 1
Brian Granger
Updating example notebooks to v3 format.
r6035 },
MinRK
regenerate example notebooks to remove transformed output
r5981 {
Brian Granger
Updating example notebooks to v3 format.
r6035 "cell_type": "code",
"collapsed": false,
MinRK
regenerate example notebooks to remove transformed output
r5981 "input": [
Brian Granger
Updating example notebooks to v3 format.
r6035 "rc = Client()",
MinRK
regenerate example notebooks to remove transformed output
r5981 "v = rc.load_balanced_view()"
Brian Granger
Updating example notebooks to v3 format.
r6035 ],
"language": "python",
"outputs": [],
MinRK
regenerate example notebooks to remove transformed output
r5981 "prompt_number": 3
Brian Granger
Updating example notebooks to v3 format.
r6035 },
MinRK
regenerate example notebooks to remove transformed output
r5981 {
Brian Granger
Updating example notebooks to v3 format.
r6035 "cell_type": "code",
"collapsed": false,
MinRK
regenerate example notebooks to remove transformed output
r5981 "input": [
Brian Granger
Updating example notebooks to v3 format.
r6035 "result = v.map(lambda x: 2*x, range(10))",
MinRK
regenerate example notebooks to remove transformed output
r5981 "print \"Simple, default map: \", list(result)"
Brian Granger
Updating example notebooks to v3 format.
r6035 ],
"language": "python",
MinRK
regenerate example notebooks to remove transformed output
r5981 "outputs": [
{
Brian Granger
Updating example notebooks to v3 format.
r6035 "output_type": "stream",
"stream": "stdout",
MinRK
regenerate example notebooks to remove transformed output
r5981 "text": [
"Simple, default map: "
]
Brian Granger
Updating example notebooks to v3 format.
r6035 },
MinRK
regenerate example notebooks to remove transformed output
r5981 {
Brian Granger
Updating example notebooks to v3 format.
r6035 "output_type": "stream",
"stream": "stdout",
MinRK
regenerate example notebooks to remove transformed output
r5981 "text": [
"[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]"
]
}
Brian Granger
Updating example notebooks to v3 format.
r6035 ],
MinRK
regenerate example notebooks to remove transformed output
r5981 "prompt_number": 4
Brian Granger
Updating example notebooks to v3 format.
r6035 },
MinRK
regenerate example notebooks to remove transformed output
r5981 {
Brian Granger
Updating example notebooks to v3 format.
r6035 "cell_type": "code",
"collapsed": false,
MinRK
regenerate example notebooks to remove transformed output
r5981 "input": [
Brian Granger
Updating example notebooks to v3 format.
r6035 "ar = v.map_async(lambda x: 2*x, range(10))",
"print \"Submitted tasks, got ids: \", ar.msg_ids",
"result = ar.get()",
MinRK
regenerate example notebooks to remove transformed output
r5981 "print \"Using a mapper: \", result"
Brian Granger
Updating example notebooks to v3 format.
r6035 ],
"language": "python",
MinRK
regenerate example notebooks to remove transformed output
r5981 "outputs": [
{
Brian Granger
Updating example notebooks to v3 format.
r6035 "output_type": "stream",
"stream": "stdout",
MinRK
regenerate example notebooks to remove transformed output
r5981 "text": [
Brian Granger
Updating example notebooks to v3 format.
r6035 "Submitted tasks, got ids: ['5100a4c7-73a4-4832-aa91-e774f6f3ede8', 'd0cae1cf-2b32-4092-9eb7-f17b43fb3849', 'e08d3ee2-f221-47fe-9556-ed938e692030', '065585e4-cdf9-4240-a5fe-e44b2ae5d023', 'd2162f23-68e5-4318-ba1e-e34fd03a72ac', '5b3b835f-2099-4a70-9896-d1aa810c77e6', 'e2c2a823-bd44-4f91-8db3-c154d0d86e56', '991e0c25-f98a-44b5-9d9e-889d4180b9a5', '4ad41221-28bd-482f-a300-97c404648161', '5b730eb3-e0bb-4cdd-b228-c3b8d158828a']",
MinRK
regenerate example notebooks to remove transformed output
r5981 "Using a mapper: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]"
]
}
Brian Granger
Updating example notebooks to v3 format.
r6035 ],
MinRK
regenerate example notebooks to remove transformed output
r5981 "prompt_number": 5
Brian Granger
Updating example notebooks to v3 format.
r6035 },
MinRK
regenerate example notebooks to remove transformed output
r5981 {
Brian Granger
Updating example notebooks to v3 format.
r6035 "cell_type": "code",
"collapsed": false,
MinRK
regenerate example notebooks to remove transformed output
r5981 "input": [
Brian Granger
Updating example notebooks to v3 format.
r6035 "@v.parallel(block=True)",
"def f(x): return 2*x",
"",
"result = f.map(range(10))",
MinRK
regenerate example notebooks to remove transformed output
r5981 "print \"Using a parallel function: \", result"
Brian Granger
Updating example notebooks to v3 format.
r6035 ],
"language": "python",
MinRK
regenerate example notebooks to remove transformed output
r5981 "outputs": [
{
Brian Granger
Updating example notebooks to v3 format.
r6035 "output_type": "stream",
"stream": "stdout",
MinRK
regenerate example notebooks to remove transformed output
r5981 "text": [
"Using a parallel function: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]"
]
}
Brian Granger
Updating example notebooks to v3 format.
r6035 ],
MinRK
regenerate example notebooks to remove transformed output
r5981 "prompt_number": 6
}
]
}
]
Brian E. Granger
Converting notebooks to JSON format.
r4634 }