From 72652d65901c14d9428191eb5a38d3c02e9063b6 2008-07-09 05:03:19 From: Brian E Granger Date: 2008-07-09 05:03:19 Subject: [PATCH] Fixed most of the examples. A few still don't work, but this is a start. --- diff --git a/docs/examples/kernel/asyncmultiengine1.py b/docs/examples/kernel/asyncmultiengine1.py index c16ca36..5b794b0 100644 --- a/docs/examples/kernel/asyncmultiengine1.py +++ b/docs/examples/kernel/asyncmultiengine1.py @@ -5,7 +5,7 @@ # asynchronous manner. The TaskClient also works in this mode. from twisted.internet import reactor, defer -from ipython1.kernel import asyncclient +from IPython.kernel import asyncclient def printer(r): print r diff --git a/docs/examples/kernel/asynctask1.py b/docs/examples/kernel/asynctask1.py index 74e2c25..2b0ca34 100644 --- a/docs/examples/kernel/asynctask1.py +++ b/docs/examples/kernel/asynctask1.py @@ -2,12 +2,13 @@ # encoding: utf-8 # This example shows how the AsynTaskClient can be used +# This example is currently broken from twisted.internet import reactor, defer -from ipython1.kernel import asynclient +from IPython.kernel import asyncclient -mec = asynclient.AsynMultiEngineClient(('localhost', 10105)) -tc = asynclient.AsynTaskClient(('localhost',10113)) +mec = asyncclient.AsyncMultiEngineClient(('localhost', 10105)) +tc = asyncclient.AsyncTaskClient(('localhost',10113)) cmd1 = """\ a = 5 @@ -15,7 +16,7 @@ b = 10*d c = a*b*d """ -t1 = asynclient.Task(cmd1, clear_before=False, clear_after=True, pull=['a','b','c']) +t1 = asyncclient.Task(cmd1, clear_before=False, clear_after=True, pull=['a','b','c']) d = mec.push(dict(d=30)) diff --git a/docs/examples/kernel/fetchparse.py b/docs/examples/kernel/fetchparse.py index afd0469..4c5d489 100644 --- a/docs/examples/kernel/fetchparse.py +++ b/docs/examples/kernel/fetchparse.py @@ -9,7 +9,7 @@ and some engines using something like:: ipcluster -n 4 """ from twisted.python.failure import Failure -from ipython1.kernel import client +from IPython.kernel import client import time fetchParse = """ diff --git a/docs/examples/kernel/helloworld.py b/docs/examples/kernel/helloworld.py index ea21ae6..a96aa34 100644 --- a/docs/examples/kernel/helloworld.py +++ b/docs/examples/kernel/helloworld.py @@ -2,7 +2,7 @@ A Distributed Hello world Ken Kinder """ -from ipython1.kernel import client +from IPython.kernel import client tc = client.TaskClient() mec = client.MultiEngineClient() diff --git a/docs/examples/kernel/mcdriver.py b/docs/examples/kernel/mcdriver.py index 7bef03e..69b9b80 100644 --- a/docs/examples/kernel/mcdriver.py +++ b/docs/examples/kernel/mcdriver.py @@ -2,7 +2,7 @@ # encoding: utf-8 """Run a Monte-Carlo options pricer in parallel.""" -from ipython1.kernel import client +from IPython.kernel import client import numpy as N from mcpricer import MCOptionPricer diff --git a/docs/examples/kernel/multiengine1.ipy b/docs/examples/kernel/multiengine1.ipy index 2231fb2..caa138b 100644 --- a/docs/examples/kernel/multiengine1.ipy +++ b/docs/examples/kernel/multiengine1.ipy @@ -5,9 +5,9 @@ import time import numpy -import ipython1.kernel.magic -from ipython1.kernel import client -from ipython1.kernel.error import * +import IPython.kernel.magic +from IPython.kernel import client +from IPython.kernel.error import * mec = client.MultiEngineClient() diff --git a/docs/examples/kernel/multiengine2.ipy b/docs/examples/kernel/multiengine2.ipy index c1f9d57..2423e64 100644 --- a/docs/examples/kernel/multiengine2.ipy +++ b/docs/examples/kernel/multiengine2.ipy @@ -5,9 +5,9 @@ import time import numpy -import ipython1.kernel.magic -from ipython1.kernel import client -from ipython1.kernel.error import * +import IPython.kernel.magic +from IPython.kernel import client +from IPython.kernel.error import * mec = client.MultiEngineClient() diff --git a/docs/examples/kernel/nwmerge.py b/docs/examples/kernel/nwmerge.py index 285912d..32447a2 100644 --- a/docs/examples/kernel/nwmerge.py +++ b/docs/examples/kernel/nwmerge.py @@ -4,7 +4,7 @@ # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/511509 import heapq -from ipython1.kernel.error import CompositeError +from IPython.kernel.error import CompositeError def mergesort(list_of_lists, key=None): """ Perform an N-way merge operation on sorted lists. @@ -91,7 +91,7 @@ def remote_iterator(rc,engine,name): # Main, interactive testing if __name__ == '__main__': - from ipython1.kernel import client + from IPython.kernel import client ipc = client.MultiEngineClient() print 'Engine IDs:',ipc.get_ids() diff --git a/docs/examples/kernel/parallel_pylab.ipy b/docs/examples/kernel/parallel_pylab.ipy index 44e7bad..63cad27 100644 --- a/docs/examples/kernel/parallel_pylab.ipy +++ b/docs/examples/kernel/parallel_pylab.ipy @@ -20,7 +20,7 @@ example. import numpy as N from pylab import * -from ipython1.kernel import client +from IPython.kernel import client # Get an IPython1 client rc = client.MultiEngineClient() diff --git a/docs/examples/kernel/plotting_frontend.py b/docs/examples/kernel/plotting_frontend.py index cb86298..87a2fa3 100644 --- a/docs/examples/kernel/plotting_frontend.py +++ b/docs/examples/kernel/plotting_frontend.py @@ -18,7 +18,7 @@ are available in IPython, so for example you can make additional plots. import numpy as N from pylab import * -from ipython1.kernel import client +from IPython.kernel import client # Get an IPython1 client rc = client.MultiEngineClient() diff --git a/docs/examples/kernel/pwordfreq.py b/docs/examples/kernel/pwordfreq.py index ba9fa0c..f96423b 100644 --- a/docs/examples/kernel/pwordfreq.py +++ b/docs/examples/kernel/pwordfreq.py @@ -25,7 +25,7 @@ def pwordfreq(rc, text): if __name__ == '__main__': # Create a MultiEngineClient - from ipython1.kernel import client + from IPython.kernel import client ipc = client.MultiEngineClient() # Run the wordfreq script on the engines. diff --git a/docs/examples/kernel/pwordfreq_skel.py b/docs/examples/kernel/pwordfreq_skel.py index 5746a1b..e5a5357 100644 --- a/docs/examples/kernel/pwordfreq_skel.py +++ b/docs/examples/kernel/pwordfreq_skel.py @@ -14,7 +14,7 @@ def pwordfreq(rc, text): if __name__ == '__main__': # Create a MultiEngineClient - from ipython1.kernel import client + from IPython.kernel import client ipc = client.MultiEngineClient() # Run the wordfreq script on the engines. diff --git a/docs/examples/kernel/rmt.ipy b/docs/examples/kernel/rmt.ipy index a14284f..c4f4063 100644 --- a/docs/examples/kernel/rmt.ipy +++ b/docs/examples/kernel/rmt.ipy @@ -7,7 +7,7 @@ # doing run rmt.ipy. from rmtkernel import * -from ipython1.kernel import client +from IPython.kernel import client def wignerDistribution(s): diff --git a/docs/examples/kernel/task1.py b/docs/examples/kernel/task1.py index c68a7b0..d233ef1 100644 --- a/docs/examples/kernel/task1.py +++ b/docs/examples/kernel/task1.py @@ -1,4 +1,4 @@ -from ipython1.kernel import client +from IPython.kernel import client tc = client.TaskClient() rc = client.MultiEngineClient() diff --git a/docs/examples/kernel/task2.py b/docs/examples/kernel/task2.py index a601963..7a3c03d 100644 --- a/docs/examples/kernel/task2.py +++ b/docs/examples/kernel/task2.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # encoding: utf-8 -from ipython1.kernel import client +from IPython.kernel import client import time tc = client.TaskClient() diff --git a/docs/examples/kernel/task_profiler.py b/docs/examples/kernel/task_profiler.py index 5f75e2b..23118d9 100644 --- a/docs/examples/kernel/task_profiler.py +++ b/docs/examples/kernel/task_profiler.py @@ -19,7 +19,7 @@ import random, sys from optparse import OptionParser from IPython.genutils import time -from ipython1.kernel import client +from IPython.kernel import client def main(): parser = OptionParser() diff --git a/docs/source/config/new_config.txt b/docs/source/config/new_config.txt index 804982a..569888a 100644 --- a/docs/source/config/new_config.txt +++ b/docs/source/config/new_config.txt @@ -18,7 +18,7 @@ configuration files are (in your ``~/.ipython`` directory): To create these files for the first time, do the following:: - from ipython1.kernel.config import config_manager as kernel_config + from IPython.kernel.config import config_manager as kernel_config kernel_config.write_default_config_file() But, you should only need to do this if you need to modify the defaults. If needed diff --git a/docs/source/parallel/parallel_intro.txt b/docs/source/parallel/parallel_intro.txt index 41205af..20eee76 100644 --- a/docs/source/parallel/parallel_intro.txt +++ b/docs/source/parallel/parallel_intro.txt @@ -217,7 +217,7 @@ Once you have started the IPython controller and one or more engines, you are ready to use the engines to do somnething useful. To make sure everything is working correctly, try the following commands:: - In [1]: from ipython1.kernel import client + In [1]: from IPython.kernel import client In [2]: mec = client.MultiEngineClient() # This looks for .furl files in ~./ipython diff --git a/docs/source/parallel/parallel_multiengine.txt b/docs/source/parallel/parallel_multiengine.txt index 9928c05..d86e541 100644 --- a/docs/source/parallel/parallel_multiengine.txt +++ b/docs/source/parallel/parallel_multiengine.txt @@ -30,7 +30,7 @@ Creating a ``MultiEngineClient`` instance The first step is to import the IPython ``client`` module and then create a ``MultiEngineClient`` instance:: - In [1]: from ipython1.kernel import client + In [1]: from IPython.kernel import client In [2]: mec = client.MultiEngineClient() @@ -303,7 +303,7 @@ The ``%autopx`` magic switches to a mode where everything you type is executed o Type %autopx to disable In [32]: max_evals = [] - + In [33]: for i in range(100): ....: a = numpy.random.rand(10,10) @@ -312,7 +312,7 @@ The ``%autopx`` magic switches to a mode where everything you type is executed o ....: max_evals.append(evals[0].real) ....: ....: - + In [34]: %autopx Auto Parallel Disabled diff --git a/docs/source/parallel/parallel_task.txt b/docs/source/parallel/parallel_task.txt index 0f44dde..94670c8 100644 --- a/docs/source/parallel/parallel_task.txt +++ b/docs/source/parallel/parallel_task.txt @@ -27,7 +27,7 @@ QuickStart Task Farming First, a quick example of how to start running the most basic Tasks. The first step is to import the IPython ``client`` module and then create a ``TaskClient`` instance:: - In [1]: from ipython1.kernel import client + In [1]: from IPython.kernel import client In [2]: tc = client.TaskClient() @@ -90,7 +90,7 @@ The TaskClient 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:: - In [1]: from ipython1.kernel import client + In [1]: from IPython.kernel import client 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::