##// END OF EJS Templates
Fixed most of the examples. A few still don't work, but this is a start.
Brian E Granger -
Show More
@@ -5,7 +5,7 b''
5 # asynchronous manner. The TaskClient also works in this mode.
5 # asynchronous manner. The TaskClient also works in this mode.
6
6
7 from twisted.internet import reactor, defer
7 from twisted.internet import reactor, defer
8 from ipython1.kernel import asyncclient
8 from IPython.kernel import asyncclient
9
9
10 def printer(r):
10 def printer(r):
11 print r
11 print r
@@ -2,12 +2,13 b''
2 # encoding: utf-8
2 # encoding: utf-8
3
3
4 # This example shows how the AsynTaskClient can be used
4 # This example shows how the AsynTaskClient can be used
5 # This example is currently broken
5
6
6 from twisted.internet import reactor, defer
7 from twisted.internet import reactor, defer
7 from ipython1.kernel import asynclient
8 from IPython.kernel import asyncclient
8
9
9 mec = asynclient.AsynMultiEngineClient(('localhost', 10105))
10 mec = asyncclient.AsyncMultiEngineClient(('localhost', 10105))
10 tc = asynclient.AsynTaskClient(('localhost',10113))
11 tc = asyncclient.AsyncTaskClient(('localhost',10113))
11
12
12 cmd1 = """\
13 cmd1 = """\
13 a = 5
14 a = 5
@@ -15,7 +16,7 b' b = 10*d'
15 c = a*b*d
16 c = a*b*d
16 """
17 """
17
18
18 t1 = asynclient.Task(cmd1, clear_before=False, clear_after=True, pull=['a','b','c'])
19 t1 = asyncclient.Task(cmd1, clear_before=False, clear_after=True, pull=['a','b','c'])
19
20
20 d = mec.push(dict(d=30))
21 d = mec.push(dict(d=30))
21
22
@@ -9,7 +9,7 b' and some engines using something like::'
9 ipcluster -n 4
9 ipcluster -n 4
10 """
10 """
11 from twisted.python.failure import Failure
11 from twisted.python.failure import Failure
12 from ipython1.kernel import client
12 from IPython.kernel import client
13 import time
13 import time
14
14
15 fetchParse = """
15 fetchParse = """
@@ -2,7 +2,7 b''
2 A Distributed Hello world
2 A Distributed Hello world
3 Ken Kinder <ken@kenkinder.com>
3 Ken Kinder <ken@kenkinder.com>
4 """
4 """
5 from ipython1.kernel import client
5 from IPython.kernel import client
6
6
7 tc = client.TaskClient()
7 tc = client.TaskClient()
8 mec = client.MultiEngineClient()
8 mec = client.MultiEngineClient()
@@ -2,7 +2,7 b''
2 # encoding: utf-8
2 # encoding: utf-8
3 """Run a Monte-Carlo options pricer in parallel."""
3 """Run a Monte-Carlo options pricer in parallel."""
4
4
5 from ipython1.kernel import client
5 from IPython.kernel import client
6 import numpy as N
6 import numpy as N
7 from mcpricer import MCOptionPricer
7 from mcpricer import MCOptionPricer
8
8
@@ -5,9 +5,9 b''
5 import time
5 import time
6 import numpy
6 import numpy
7
7
8 import ipython1.kernel.magic
8 import IPython.kernel.magic
9 from ipython1.kernel import client
9 from IPython.kernel import client
10 from ipython1.kernel.error import *
10 from IPython.kernel.error import *
11
11
12 mec = client.MultiEngineClient()
12 mec = client.MultiEngineClient()
13
13
@@ -5,9 +5,9 b''
5 import time
5 import time
6 import numpy
6 import numpy
7
7
8 import ipython1.kernel.magic
8 import IPython.kernel.magic
9 from ipython1.kernel import client
9 from IPython.kernel import client
10 from ipython1.kernel.error import *
10 from IPython.kernel.error import *
11
11
12 mec = client.MultiEngineClient()
12 mec = client.MultiEngineClient()
13
13
@@ -4,7 +4,7 b''
4 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/511509
4 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/511509
5
5
6 import heapq
6 import heapq
7 from ipython1.kernel.error import CompositeError
7 from IPython.kernel.error import CompositeError
8
8
9 def mergesort(list_of_lists, key=None):
9 def mergesort(list_of_lists, key=None):
10 """ Perform an N-way merge operation on sorted lists.
10 """ Perform an N-way merge operation on sorted lists.
@@ -91,7 +91,7 b' def remote_iterator(rc,engine,name):'
91 # Main, interactive testing
91 # Main, interactive testing
92 if __name__ == '__main__':
92 if __name__ == '__main__':
93
93
94 from ipython1.kernel import client
94 from IPython.kernel import client
95 ipc = client.MultiEngineClient()
95 ipc = client.MultiEngineClient()
96 print 'Engine IDs:',ipc.get_ids()
96 print 'Engine IDs:',ipc.get_ids()
97
97
@@ -20,7 +20,7 b' example.'
20
20
21 import numpy as N
21 import numpy as N
22 from pylab import *
22 from pylab import *
23 from ipython1.kernel import client
23 from IPython.kernel import client
24
24
25 # Get an IPython1 client
25 # Get an IPython1 client
26 rc = client.MultiEngineClient()
26 rc = client.MultiEngineClient()
@@ -18,7 +18,7 b' are available in IPython, so for example you can make additional plots.'
18
18
19 import numpy as N
19 import numpy as N
20 from pylab import *
20 from pylab import *
21 from ipython1.kernel import client
21 from IPython.kernel import client
22
22
23 # Get an IPython1 client
23 # Get an IPython1 client
24 rc = client.MultiEngineClient()
24 rc = client.MultiEngineClient()
@@ -25,7 +25,7 b' def pwordfreq(rc, text):'
25
25
26 if __name__ == '__main__':
26 if __name__ == '__main__':
27 # Create a MultiEngineClient
27 # Create a MultiEngineClient
28 from ipython1.kernel import client
28 from IPython.kernel import client
29 ipc = client.MultiEngineClient()
29 ipc = client.MultiEngineClient()
30
30
31 # Run the wordfreq script on the engines.
31 # Run the wordfreq script on the engines.
@@ -14,7 +14,7 b' def pwordfreq(rc, text):'
14
14
15 if __name__ == '__main__':
15 if __name__ == '__main__':
16 # Create a MultiEngineClient
16 # Create a MultiEngineClient
17 from ipython1.kernel import client
17 from IPython.kernel import client
18 ipc = client.MultiEngineClient()
18 ipc = client.MultiEngineClient()
19
19
20 # Run the wordfreq script on the engines.
20 # Run the wordfreq script on the engines.
@@ -7,7 +7,7 b''
7 # doing run rmt.ipy.
7 # doing run rmt.ipy.
8
8
9 from rmtkernel import *
9 from rmtkernel import *
10 from ipython1.kernel import client
10 from IPython.kernel import client
11
11
12
12
13 def wignerDistribution(s):
13 def wignerDistribution(s):
@@ -1,4 +1,4 b''
1 from ipython1.kernel import client
1 from IPython.kernel import client
2
2
3 tc = client.TaskClient()
3 tc = client.TaskClient()
4 rc = client.MultiEngineClient()
4 rc = client.MultiEngineClient()
@@ -1,7 +1,7 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # encoding: utf-8
2 # encoding: utf-8
3
3
4 from ipython1.kernel import client
4 from IPython.kernel import client
5 import time
5 import time
6
6
7 tc = client.TaskClient()
7 tc = client.TaskClient()
@@ -19,7 +19,7 b' import random, sys'
19 from optparse import OptionParser
19 from optparse import OptionParser
20
20
21 from IPython.genutils import time
21 from IPython.genutils import time
22 from ipython1.kernel import client
22 from IPython.kernel import client
23
23
24 def main():
24 def main():
25 parser = OptionParser()
25 parser = OptionParser()
@@ -18,7 +18,7 b' configuration files are (in your ``~/.ipython`` directory):'
18
18
19 To create these files for the first time, do the following::
19 To create these files for the first time, do the following::
20
20
21 from ipython1.kernel.config import config_manager as kernel_config
21 from IPython.kernel.config import config_manager as kernel_config
22 kernel_config.write_default_config_file()
22 kernel_config.write_default_config_file()
23
23
24 But, you should only need to do this if you need to modify the defaults. If needed
24 But, you should only need to do this if you need to modify the defaults. If needed
@@ -217,7 +217,7 b' Once you have started the IPython controller and one or more engines, you'
217 are ready to use the engines to do somnething useful. To make sure
217 are ready to use the engines to do somnething useful. To make sure
218 everything is working correctly, try the following commands::
218 everything is working correctly, try the following commands::
219
219
220 In [1]: from ipython1.kernel import client
220 In [1]: from IPython.kernel import client
221
221
222 In [2]: mec = client.MultiEngineClient() # This looks for .furl files in ~./ipython
222 In [2]: mec = client.MultiEngineClient() # This looks for .furl files in ~./ipython
223
223
@@ -30,7 +30,7 b' Creating a ``MultiEngineClient`` instance'
30
30
31 The first step is to import the IPython ``client`` module and then create a ``MultiEngineClient`` instance::
31 The first step is to import the IPython ``client`` module and then create a ``MultiEngineClient`` instance::
32
32
33 In [1]: from ipython1.kernel import client
33 In [1]: from IPython.kernel import client
34
34
35 In [2]: mec = client.MultiEngineClient()
35 In [2]: mec = client.MultiEngineClient()
36
36
@@ -303,7 +303,7 b' The ``%autopx`` magic switches to a mode where everything you type is executed o'
303 Type %autopx to disable
303 Type %autopx to disable
304
304
305 In [32]: max_evals = []
305 In [32]: max_evals = []
306 <ipython1.kernel.multiengineclient.PendingResult object at 0x17b8a70>
306 <IPython.kernel.multiengineclient.PendingResult object at 0x17b8a70>
307
307
308 In [33]: for i in range(100):
308 In [33]: for i in range(100):
309 ....: a = numpy.random.rand(10,10)
309 ....: a = numpy.random.rand(10,10)
@@ -312,7 +312,7 b' The ``%autopx`` magic switches to a mode where everything you type is executed o'
312 ....: max_evals.append(evals[0].real)
312 ....: max_evals.append(evals[0].real)
313 ....:
313 ....:
314 ....:
314 ....:
315 <ipython1.kernel.multiengineclient.PendingResult object at 0x17af8f0>
315 <IPython.kernel.multiengineclient.PendingResult object at 0x17af8f0>
316
316
317 In [34]: %autopx
317 In [34]: %autopx
318 Auto Parallel Disabled
318 Auto Parallel Disabled
@@ -27,7 +27,7 b' QuickStart Task Farming'
27 First, a quick example of how to start running the most basic Tasks.
27 First, a quick example of how to start running the most basic Tasks.
28 The first step is to import the IPython ``client`` module and then create a ``TaskClient`` instance::
28 The first step is to import the IPython ``client`` module and then create a ``TaskClient`` instance::
29
29
30 In [1]: from ipython1.kernel import client
30 In [1]: from IPython.kernel import client
31
31
32 In [2]: tc = client.TaskClient()
32 In [2]: tc = client.TaskClient()
33
33
@@ -90,7 +90,7 b' The TaskClient'
90
90
91 The ``TaskClient`` is the object the user use to connect to the ``Controller`` that is managing the user's Tasks. It is the analog of the ``MultiEngineClient`` for the standard IPython multiplexing interface. As with all client interfaces, the first step is to import the IPython Client Module::
91 The ``TaskClient`` is the object the user use to connect to the ``Controller`` that is managing the user's Tasks. It is the analog of the ``MultiEngineClient`` for the standard IPython multiplexing interface. As with all client interfaces, the first step is to import the IPython Client Module::
92
92
93 In [1]: from ipython1.kernel import client
93 In [1]: from IPython.kernel import client
94
94
95 Just as with the ``MultiEngineClient``, the user create the ``TaskClient`` with a tuple, containing the ip-address and port of the ``Controller``. the ``client`` module conveniently has the default address of the ``Task`` interface of the controller. Creating a default ``TaskClient`` object would be done with this::
95 Just as with the ``MultiEngineClient``, the user create the ``TaskClient`` with a tuple, containing the ip-address and port of the ``Controller``. the ``client`` module conveniently has the default address of the ``Task`` interface of the controller. Creating a default ``TaskClient`` object would be done with this::
96
96
General Comments 0
You need to be logged in to leave comments. Login now