Show More
@@ -152,8 +152,10 b' class ParallelFunction(RemoteFunction):' | |||
|
152 | 152 | dist : str [default: 'b'] |
|
153 | 153 | The key for which mapObject to use to distribute sequences |
|
154 | 154 | options are: |
|
155 | * 'b' : use contiguous chunks in order | |
|
156 | * 'r' : use round-robin striping | |
|
155 | ||
|
156 | * 'b' : use contiguous chunks in order | |
|
157 | * 'r' : use round-robin striping | |
|
158 | ||
|
157 | 159 | block : bool [default: None] |
|
158 | 160 | Whether to wait for results or not. The default behavior is |
|
159 | 161 | to use the current `block` attribute of `view` |
@@ -162,7 +164,8 b' class ParallelFunction(RemoteFunction):' | |||
|
162 | 164 | ordered : bool [default: True] |
|
163 | 165 | Whether the result should be kept in order. If False, |
|
164 | 166 | results become available as they arrive, regardless of submission order. |
|
165 | **flags : remaining kwargs are passed to View.temp_flags | |
|
167 | **flags | |
|
168 | remaining kwargs are passed to View.temp_flags | |
|
166 | 169 | """ |
|
167 | 170 | |
|
168 | 171 | chunksize = None |
@@ -221,30 +221,27 b' class View(HasTraits):' | |||
|
221 | 221 | raise NotImplementedError("Implement in subclasses") |
|
222 | 222 | |
|
223 | 223 | def apply(self, f, *args, **kwargs): |
|
224 | """calls f(*args, **kwargs) on remote engines, returning the result. | |
|
224 | """calls ``f(*args, **kwargs)`` on remote engines, returning the result. | |
|
225 | 225 | |
|
226 | 226 | This method sets all apply flags via this View's attributes. |
|
227 | 227 | |
|
228 | if self.block is False: | |
|
229 | returns AsyncResult | |
|
230 | else: | |
|
231 | returns actual result of f(*args, **kwargs) | |
|
228 | Returns :class:`~IPython.parallel.client.asyncresult.AsyncResult` | |
|
229 | instance if ``self.block`` is False, otherwise the return value of | |
|
230 | ``f(*args, **kwargs)``. | |
|
232 | 231 | """ |
|
233 | 232 | return self._really_apply(f, args, kwargs) |
|
234 | 233 | |
|
235 | 234 | def apply_async(self, f, *args, **kwargs): |
|
236 | """calls f(*args, **kwargs) on remote engines in a nonblocking manner. | |
|
235 | """calls ``f(*args, **kwargs)`` on remote engines in a nonblocking manner. | |
|
237 | 236 | |
|
238 | returns AsyncResult | |
|
237 | Returns :class:`~IPython.parallel.client.asyncresult.AsyncResult` instance. | |
|
239 | 238 | """ |
|
240 | 239 | return self._really_apply(f, args, kwargs, block=False) |
|
241 | 240 | |
|
242 | 241 | @spin_after |
|
243 | 242 | def apply_sync(self, f, *args, **kwargs): |
|
244 | """calls f(*args, **kwargs) on remote engines in a blocking manner, | |
|
243 | """calls ``f(*args, **kwargs)`` on remote engines in a blocking manner, | |
|
245 | 244 | returning the result. |
|
246 | ||
|
247 | returns: actual result of f(*args, **kwargs) | |
|
248 | 245 | """ |
|
249 | 246 | return self._really_apply(f, args, kwargs, block=True) |
|
250 | 247 | |
@@ -320,8 +317,7 b' class View(HasTraits):' | |||
|
320 | 317 | def get_result(self, indices_or_msg_ids=None): |
|
321 | 318 | """return one or more results, specified by history index or msg_id. |
|
322 | 319 | |
|
323 | See client.get_result for details. | |
|
324 | ||
|
320 | See :meth:`IPython.parallel.client.client.Client.get_result` for details. | |
|
325 | 321 | """ |
|
326 | 322 | |
|
327 | 323 | if indices_or_msg_ids is None: |
@@ -345,9 +341,9 b' class View(HasTraits):' | |||
|
345 | 341 | raise NotImplementedError |
|
346 | 342 | |
|
347 | 343 | def map_async(self, f, *sequences, **kwargs): |
|
348 | """Parallel version of builtin `map`, using this view's engines. | |
|
344 | """Parallel version of builtin :func:`python:map`, using this view's engines. | |
|
349 | 345 | |
|
350 | This is equivalent to map(...block=False) | |
|
346 | This is equivalent to ``map(...block=False)``. | |
|
351 | 347 | |
|
352 | 348 | See `self.map` for details. |
|
353 | 349 | """ |
@@ -357,9 +353,9 b' class View(HasTraits):' | |||
|
357 | 353 | return self.map(f,*sequences,**kwargs) |
|
358 | 354 | |
|
359 | 355 | def map_sync(self, f, *sequences, **kwargs): |
|
360 | """Parallel version of builtin `map`, using this view's engines. | |
|
356 | """Parallel version of builtin :func:`python:map`, using this view's engines. | |
|
361 | 357 | |
|
362 | This is equivalent to map(...block=True) | |
|
358 | This is equivalent to ``map(...block=True)``. | |
|
363 | 359 | |
|
364 | 360 | See `self.map` for details. |
|
365 | 361 | """ |
@@ -369,7 +365,7 b' class View(HasTraits):' | |||
|
369 | 365 | return self.map(f,*sequences,**kwargs) |
|
370 | 366 | |
|
371 | 367 | def imap(self, f, *sequences, **kwargs): |
|
372 | """Parallel version of `itertools.imap`. | |
|
368 | """Parallel version of :func:`itertools.imap`. | |
|
373 | 369 | |
|
374 | 370 | See `self.map` for details. |
|
375 | 371 | |
@@ -575,7 +571,7 b' class DirectView(View):' | |||
|
575 | 571 | |
|
576 | 572 | @sync_results |
|
577 | 573 | def map(self, f, *sequences, **kwargs): |
|
578 | """view.map(f, *sequences, block=self.block) => list|AsyncMapResult | |
|
574 | """``view.map(f, *sequences, block=self.block)`` => list|AsyncMapResult | |
|
579 | 575 | |
|
580 | 576 | Parallel version of builtin `map`, using this View's `targets`. |
|
581 | 577 | |
@@ -597,14 +593,14 b' class DirectView(View):' | |||
|
597 | 593 | Returns |
|
598 | 594 | ------- |
|
599 | 595 | |
|
600 | if block=False: | |
|
601 | AsyncMapResult | |
|
602 | An object like AsyncResult, but which reassembles the sequence of results | |
|
603 | into a single list. AsyncMapResults can be iterated through before all | |
|
604 | results are complete. | |
|
605 | else: | |
|
606 |
|
|
|
607 |
|
|
|
596 | ||
|
597 | If block=False | |
|
598 | An :class:`~IPython.parallel.client.asyncresult.AsyncMapResult` instance. | |
|
599 | An object like AsyncResult, but which reassembles the sequence of results | |
|
600 | into a single list. AsyncMapResults can be iterated through before all | |
|
601 | results are complete. | |
|
602 | else | |
|
603 | A list, the result of ``map(f,*sequences)`` | |
|
608 | 604 | """ |
|
609 | 605 | |
|
610 | 606 | block = kwargs.pop('block', self.block) |
@@ -1056,7 +1052,7 b' class LoadBalancedView(View):' | |||
|
1056 | 1052 | @sync_results |
|
1057 | 1053 | @save_ids |
|
1058 | 1054 | def map(self, f, *sequences, **kwargs): |
|
1059 | """view.map(f, *sequences, block=self.block, chunksize=1, ordered=True) => list|AsyncMapResult | |
|
1055 | """``view.map(f, *sequences, block=self.block, chunksize=1, ordered=True)`` => list|AsyncMapResult | |
|
1060 | 1056 | |
|
1061 | 1057 | Parallel version of builtin `map`, load-balanced by this View. |
|
1062 | 1058 | |
@@ -1091,14 +1087,13 b' class LoadBalancedView(View):' | |||
|
1091 | 1087 | Returns |
|
1092 | 1088 | ------- |
|
1093 | 1089 | |
|
1094 |
if block=False |
|
|
1095 | AsyncMapResult | |
|
1096 |
|
|
|
1097 |
|
|
|
1098 |
|
|
|
1099 |
|
|
|
1100 |
|
|
|
1101 | ||
|
1090 | if block=False | |
|
1091 | An :class:`~IPython.parallel.client.asyncresult.AsyncMapResult` instance. | |
|
1092 | An object like AsyncResult, but which reassembles the sequence of results | |
|
1093 | into a single list. AsyncMapResults can be iterated through before all | |
|
1094 | results are complete. | |
|
1095 | else | |
|
1096 | A list, the result of ``map(f,*sequences)`` | |
|
1102 | 1097 | """ |
|
1103 | 1098 | |
|
1104 | 1099 | # default |
@@ -105,17 +105,16 b' def require(*objects, **mapping):' | |||
|
105 | 105 | and will be pushed to the engine with their __name__. |
|
106 | 106 | Other objects can be passed by keyword arg. |
|
107 | 107 | |
|
108 | Examples | |
|
109 | -------- | |
|
108 | Examples:: | |
|
110 | 109 | |
|
111 | In [1]: @require('numpy') | |
|
112 | ...: def norm(a): | |
|
113 | ...: return numpy.linalg.norm(a,2) | |
|
110 | In [1]: @require('numpy') | |
|
111 | ...: def norm(a): | |
|
112 | ...: return numpy.linalg.norm(a,2) | |
|
114 | 113 | |
|
115 | In [2]: foo = lambda x: x*x | |
|
116 | In [3]: @require(foo) | |
|
117 | ...: def bar(a): | |
|
118 | ...: return foo(1-a) | |
|
114 | In [2]: foo = lambda x: x*x | |
|
115 | In [3]: @require(foo) | |
|
116 | ...: def bar(a): | |
|
117 | ...: return foo(1-a) | |
|
119 | 118 | """ |
|
120 | 119 | names = [] |
|
121 | 120 | for obj in objects: |
@@ -6,37 +6,42 b' Authors:' | |||
|
6 | 6 | * Min RK |
|
7 | 7 | |
|
8 | 8 | |
|
9 | TaskRecords are dicts of the form: | |
|
10 | { | |
|
11 | 'msg_id' : str(uuid), | |
|
12 |
|
|
|
13 |
|
|
|
14 | 'header' : dict(header), | |
|
15 | 'content': dict(content), | |
|
16 | 'buffers': list(buffers), | |
|
17 | 'submitted': datetime, | |
|
18 |
'st |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
'resu |
|
|
22 |
'result_ |
|
|
23 |
'result_ |
|
|
24 | } | |
|
25 | With this info, many of the special categories of tasks can be defined by query: | |
|
26 | ||
|
27 | pending: completed is None | |
|
28 | client's outstanding: client_uuid = uuid && completed is None | |
|
29 | MIA: arrived is None (and completed is None) | |
|
30 | etc. | |
|
9 | TaskRecords are dicts of the form:: | |
|
10 | ||
|
11 | { | |
|
12 | 'msg_id' : str(uuid), | |
|
13 | 'client_uuid' : str(uuid), | |
|
14 | 'engine_uuid' : str(uuid) or None, | |
|
15 | 'header' : dict(header), | |
|
16 | 'content': dict(content), | |
|
17 | 'buffers': list(buffers), | |
|
18 | 'submitted': datetime, | |
|
19 | 'started': datetime or None, | |
|
20 | 'completed': datetime or None, | |
|
21 | 'resubmitted': datetime or None, | |
|
22 | 'result_header' : dict(header) or None, | |
|
23 | 'result_content' : dict(content) or None, | |
|
24 | 'result_buffers' : list(buffers) or None, | |
|
25 | } | |
|
26 | ||
|
27 | With this info, many of the special categories of tasks can be defined by query, | |
|
28 | e.g.: | |
|
29 | ||
|
30 | * pending: completed is None | |
|
31 | * client's outstanding: client_uuid = uuid && completed is None | |
|
32 | * MIA: arrived is None (and completed is None) | |
|
33 | ||
|
34 | EngineRecords are dicts of the form:: | |
|
35 | ||
|
36 | { | |
|
37 | 'eid' : int(id), | |
|
38 | 'uuid': str(uuid) | |
|
39 | } | |
|
31 | 40 | |
|
32 | EngineRecords are dicts of the form: | |
|
33 | { | |
|
34 | 'eid' : int(id), | |
|
35 | 'uuid': str(uuid) | |
|
36 | } | |
|
37 | 41 | This may be extended, but is currently. |
|
38 | 42 | |
|
39 | We support a subset of mongodb operators: | |
|
43 | We support a subset of mongodb operators:: | |
|
44 | ||
|
40 | 45 | $lt,$gt,$lte,$gte,$ne,$in,$nin,$all,$mod,$exists |
|
41 | 46 | """ |
|
42 | 47 | #----------------------------------------------------------------------------- |
@@ -1149,11 +1149,15 b' class Hub(SessionFactory):' | |||
|
1149 | 1149 | |
|
1150 | 1150 | def queue_status(self, client_id, msg): |
|
1151 | 1151 | """Return the Queue status of one or more targets. |
|
1152 | if verbose: return the msg_ids | |
|
1153 |
else |
|
|
1154 | keys: queue (pending MUX jobs) | |
|
1155 | tasks (pending Task jobs) | |
|
1156 | completed (finished jobs from both queues)""" | |
|
1152 | ||
|
1153 | If verbose, return the msg_ids, else return len of each type. | |
|
1154 | ||
|
1155 | Keys: | |
|
1156 | ||
|
1157 | * queue (pending MUX jobs) | |
|
1158 | * tasks (pending Task jobs) | |
|
1159 | * completed (finished jobs from both queues) | |
|
1160 | """ | |
|
1157 | 1161 | content = msg['content'] |
|
1158 | 1162 | targets = content['targets'] |
|
1159 | 1163 | try: |
@@ -199,7 +199,8 b' def disambiguate_url(url, location=None):' | |||
|
199 | 199 | """turn multi-ip interfaces '0.0.0.0' and '*' into connectable |
|
200 | 200 | ones, based on the location (default interpretation is localhost). |
|
201 | 201 | |
|
202 |
This is for zeromq urls, such as tcp://*:10101. |
|
|
202 | This is for zeromq urls, such as ``tcp://*:10101``. | |
|
203 | """ | |
|
203 | 204 | try: |
|
204 | 205 | proto,ip,port = split_url(url) |
|
205 | 206 | except AssertionError: |
@@ -560,12 +560,11 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
560 | 560 | The returned line does not include the trailing newline. |
|
561 | 561 | When the user enters the EOF key sequence, EOFError is raised. |
|
562 | 562 | |
|
563 | Optional inputs: | |
|
563 | Parameters | |
|
564 | ---------- | |
|
564 | 565 | |
|
565 | - prompt(''): a string to be printed to prompt the user. | |
|
566 | ||
|
567 | - continue_prompt(False): whether this line is the first one or a | |
|
568 | continuation in a sequence of inputs. | |
|
566 | prompt : str, optional | |
|
567 | A string to be printed to prompt the user. | |
|
569 | 568 | """ |
|
570 | 569 | # Code run by the user may have modified the readline completer state. |
|
571 | 570 | # We must ensure that our completer is back in place. |
@@ -175,20 +175,21 b' def skipif(skip_condition, msg=None):' | |||
|
175 | 175 | |
|
176 | 176 | Parameters |
|
177 | 177 | ---------- |
|
178 | skip_condition : bool or callable. | |
|
179 | Flag to determine whether to skip test. If the condition is a | |
|
180 | callable, it is used at runtime to dynamically make the decision. This | |
|
181 | is useful for tests that may require costly imports, to delay the cost | |
|
182 | until the test suite is actually executed. | |
|
178 | ||
|
179 | skip_condition : bool or callable | |
|
180 | Flag to determine whether to skip test. If the condition is a | |
|
181 | callable, it is used at runtime to dynamically make the decision. This | |
|
182 | is useful for tests that may require costly imports, to delay the cost | |
|
183 | until the test suite is actually executed. | |
|
183 | 184 | msg : string |
|
184 |
|
|
|
185 | ||
|
186 | Returns | |
|
187 | ------- | |
|
188 | decorator : function | |
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
|
185 | Message to give on raising a SkipTest exception. | |
|
186 | ||
|
187 | Returns | |
|
188 | ------- | |
|
189 | decorator : function | |
|
190 | Decorator, which, when applied to a function, causes SkipTest | |
|
191 | to be raised when the skip_condition was True, and the function | |
|
192 | to be called normally otherwise. | |
|
192 | 193 | |
|
193 | 194 | Notes |
|
194 | 195 | ----- |
@@ -140,7 +140,7 b' Pull requests (257):' | |||
|
140 | 140 | * `1126 <https://github.com/ipython/ipython/issues/1126>`_: Totally remove pager when read only (notebook) |
|
141 | 141 | * `1091 <https://github.com/ipython/ipython/issues/1091>`_: qtconsole : allow copy with shortcut in pager |
|
142 | 142 | * `1114 <https://github.com/ipython/ipython/issues/1114>`_: fix magics history in two-process ipython console |
|
143 |
* `1113 <https://github.com/ipython/ipython/issues/1113>`_: Fixing #1112 removing failing asserts for test_carriage_return and test_ |
|
|
143 | * `1113 <https://github.com/ipython/ipython/issues/1113>`_: Fixing #1112 removing failing asserts for test_carriage_return and test_beep | |
|
144 | 144 | * `1089 <https://github.com/ipython/ipython/issues/1089>`_: Support carriage return ('\r') and beep ('\b') characters in the qtconsole |
|
145 | 145 | * `1108 <https://github.com/ipython/ipython/issues/1108>`_: Completer usability 2 (rebased of pr #1082) |
|
146 | 146 | * `864 <https://github.com/ipython/ipython/issues/864>`_: Two-process terminal frontend (ipython core branch) |
@@ -643,7 +643,7 b' Pull Requests (793):' | |||
|
643 | 643 | * :ghpull:`3223`: add missing mathjax_url to new settings dict |
|
644 | 644 | * :ghpull:`3089`: add stdin to the notebook |
|
645 | 645 | * :ghpull:`3221`: Remove references to HTMLCell (dead code) |
|
646 | * :ghpull:`3205`: add ignored *args to HasTraits constructor | |
|
646 | * :ghpull:`3205`: add ignored ``*args`` to HasTraits constructor | |
|
647 | 647 | * :ghpull:`3088`: cleanup IPython handler settings |
|
648 | 648 | * :ghpull:`3201`: use much faster regexp for ansi coloring |
|
649 | 649 | * :ghpull:`3220`: avoid race condition in profile creation |
@@ -1064,7 +1064,7 b' Pull Requests (793):' | |||
|
1064 | 1064 | * :ghpull:`2140`: 2to3: Apply `has_key` fixer. |
|
1065 | 1065 | * :ghpull:`2131`: Add option append (-a) to %save |
|
1066 | 1066 | * :ghpull:`2117`: use explicit url in notebook example |
|
1067 | * :ghpull:`2133`: Tell git that *.py files contain Python code, for use in word-diffs. | |
|
1067 | * :ghpull:`2133`: Tell git that ``*.py`` files contain Python code, for use in word-diffs. | |
|
1068 | 1068 | * :ghpull:`2134`: Apply 2to3 `next` fix. |
|
1069 | 1069 | * :ghpull:`2126`: ipcluster broken with any batch launcher (PBS/LSF/SGE) |
|
1070 | 1070 | * :ghpull:`2104`: Windows make file for Sphinx documentation |
@@ -1423,7 +1423,7 b' Issues (691):' | |||
|
1423 | 1423 | * :ghissue:`3207`: [Feature] folders for ipython notebook dashboard |
|
1424 | 1424 | * :ghissue:`3178`: cell magics do not work with empty lines after #2447 |
|
1425 | 1425 | * :ghissue:`3204`: Default plot() colors unsuitable for red-green colorblind users |
|
1426 | * :ghissue:`1789`: :\n/*foo turns into :\n*(foo) in triple-quoted strings. | |
|
1426 | * :ghissue:`1789`: ``:\n/*foo`` turns into ``:\n*(foo)`` in triple-quoted strings. | |
|
1427 | 1427 | * :ghissue:`3202`: File cell magic fails with blank lines |
|
1428 | 1428 | * :ghissue:`3199`: %%cython -a stopped working? |
|
1429 | 1429 | * :ghissue:`2688`: obsolete imports in import autocompletion |
@@ -1649,7 +1649,7 b' Issues (691):' | |||
|
1649 | 1649 | * :ghissue:`1308`: ipython qtconsole --ssh=server --existing ... hangs |
|
1650 | 1650 | * :ghissue:`1679`: List command doesn't work in ipdb debugger the first time |
|
1651 | 1651 | * :ghissue:`2545`: pypi win32 installer creates 64bit executibles |
|
1652 | * :ghissue:`2080`: Event loop issues with IPython 0.12 and PyQt4 (QDialog.exec_ and more) | |
|
1652 | * :ghissue:`2080`: Event loop issues with IPython 0.12 and PyQt4 (``QDialog.exec_`` and more) | |
|
1653 | 1653 | * :ghissue:`2541`: Allow `python -m IPython` |
|
1654 | 1654 | * :ghissue:`2508`: subplots_adjust() does not work correctly in ipython notebook |
|
1655 | 1655 | * :ghissue:`2289`: Incorrect mathjax rendering of certain arrays of equations |
General Comments 0
You need to be logged in to leave comments.
Login now