Show More
@@ -377,7 +377,7 b' The following examples demonstrate how to use the instance attributes:' | |||||
377 | In [19]: ar.get() |
|
377 | In [19]: ar.get() | |
378 | Out[19]: [10, 10] |
|
378 | Out[19]: [10, 10] | |
379 |
|
379 | |||
380 |
In [20]: dview.targets = |
|
380 | In [20]: dview.targets = rc.ids # all engines (4) | |
381 |
|
381 | |||
382 | In [21]: dview.block = True |
|
382 | In [21]: dview.block = True | |
383 |
|
383 | |||
@@ -522,13 +522,13 b' be collected and raise a CompositeError, as demonstrated in the next section.' | |||||
522 |
|
522 | |||
523 | In [69]: from IPython.parallel import require |
|
523 | In [69]: from IPython.parallel import require | |
524 |
|
524 | |||
525 |
In [70]: @require('re') |
|
525 | In [70]: @require('re') | |
526 | ....: def findall(pat, x): |
|
526 | ....: def findall(pat, x): | |
527 | ....: # re is guaranteed to be available |
|
527 | ....: # re is guaranteed to be available | |
528 | ....: return re.findall(pat, x) |
|
528 | ....: return re.findall(pat, x) | |
529 |
|
529 | |||
530 | # you can also pass modules themselves, that you already have locally: |
|
530 | # you can also pass modules themselves, that you already have locally: | |
531 |
In [71]: @require(time) |
|
531 | In [71]: @require(time) | |
532 | ....: def wait(t): |
|
532 | ....: def wait(t): | |
533 | ....: time.sleep(t) |
|
533 | ....: time.sleep(t) | |
534 | ....: return t |
|
534 | ....: return t | |
@@ -588,9 +588,11 b' If you want, you can even raise one of these original exceptions:' | |||||
588 |
|
588 | |||
589 | .. sourcecode:: ipython |
|
589 | .. sourcecode:: ipython | |
590 |
|
590 | |||
|
591 | In [79]: from IPython.parallel import CompositeError | |||
|
592 | ||||
591 | In [80]: try: |
|
593 | In [80]: try: | |
592 | ....: dview.execute('1/0', block=True) |
|
594 | ....: dview.execute('1/0', block=True) | |
593 |
....: except |
|
595 | ....: except CompositeError, e: | |
594 | ....: e.raise_exception() |
|
596 | ....: e.raise_exception() | |
595 | ....: |
|
597 | ....: | |
596 | ....: |
|
598 | ....: | |
@@ -669,12 +671,12 b' You can change this limit to suit your needs with:' | |||||
669 |
|
671 | |||
670 | In [20]: from IPython.parallel import CompositeError |
|
672 | In [20]: from IPython.parallel import CompositeError | |
671 | In [21]: CompositeError.tb_limit = 1 |
|
673 | In [21]: CompositeError.tb_limit = 1 | |
672 |
In [22]: %px |
|
674 | In [22]: %px x=z | |
673 | [0:execute]: |
|
675 | [0:execute]: | |
674 | --------------------------------------------------------------------------- |
|
676 | --------------------------------------------------------------------------- | |
675 | NameError Traceback (most recent call last) |
|
677 | NameError Traceback (most recent call last) | |
676 |
----> 1 |
|
678 | ----> 1 x=z | |
677 |
NameError: name ' |
|
679 | NameError: name 'z' is not defined | |
678 |
|
680 | |||
679 | ... 3 more exceptions ... |
|
681 | ... 3 more exceptions ... | |
680 |
|
682 |
@@ -186,7 +186,7 b' will be assigned to another engine. If the dependency returns *anything other th' | |||||
186 | ....: def wintask(): |
|
186 | ....: def wintask(): | |
187 | ....: do_windows_stuff() |
|
187 | ....: do_windows_stuff() | |
188 |
|
188 | |||
189 |
In this case, any time you apply ``m |
|
189 | In this case, any time you apply ``mactask``, it will only run on an OSX machine. | |
190 | ``@depend`` is just like ``apply``, in that it has a ``@depend(f,*args,**kwargs)`` |
|
190 | ``@depend`` is just like ``apply``, in that it has a ``@depend(f,*args,**kwargs)`` | |
191 | signature. |
|
191 | signature. | |
192 |
|
192 |
General Comments 0
You need to be logged in to leave comments.
Login now