Inheritance diagram for IPython.parallel.client.magics:
Magic command interface for interactive parallel work.
%autopx
Toggles auto parallel mode.
Once this is called, all commands typed at the command line are send to the engines to be executed in parallel. To control which engine are used, the targets attribute of the view before entering %autopx mode.
Then you can do the following:
In [25]: %autopx %autopx to enabled In [26]: a = 10 Parallel execution on engine(s): [0,1,2,3] In [27]: print a Parallel execution on engine(s): [0,1,2,3] [stdout:0] 10 [stdout:1] 10 [stdout:2] 10 [stdout:3] 10 In [27]: %autopx %autopx disabled
%px
Executes the given python command in parallel.
In [24]: %px a = os.getpid() Parallel execution on engine(s): all In [25]: %px print a [stdout:0] 1234 [stdout:1] 1235 [stdout:2] 1236 [stdout:3] 1237
%pxresult
%result [-o SAVE_NAME] [–group-outputs {engine,order,type}] [-e] [-r]
Print the result of the last asynchronous %px command.
This lets you recall the results of %px computations after asynchronous submission (block=False).
In [23]: %px os.getpid()
Async parallel execution on engine(s): all
In [24]: %pxresult
Out[8:10]: 60920
Out[9:10]: 60921
Out[10:10]: 60922
Out[11:10]: 60923
-o SAVE_NAME, --out SAVE_NAME | |
store the AsyncResult object for this computation in the global namespace under this name. |
-e | group outputs by engine (same as group-outputs=engine) |
-r | collate outputs in order (same as group-outputs=order) |
%pxconfig
%pxconfig [–no-verbose] [–verbose] [-t TARGETS] [-a] [-b]
configure default targets/blocking for %px magics
--no-verbose | don’t print any messages |
--verbose | print a message at each execution |
-t TARGETS, --targets TARGETS | |
specify the targets on which to execute | |
-a, --noblock | use non-blocking (async) execution |
-b, --block | use blocking (sync) execution |
Bases: IPython.core.magic.Magics
A set of magics useful when controlling a parallel IPython cluster.
Print docstring if incorrect arguments were passed
Toggles auto parallel mode.
Once this is called, all commands typed at the command line are send to the engines to be executed in parallel. To control which engine are used, the targets attribute of the view before entering %autopx mode.
Then you can do the following:
In [25]: %autopx
%autopx to enabled
In [26]: a = 10
Parallel execution on engine(s): [0,1,2,3]
In [27]: print a
Parallel execution on engine(s): [0,1,2,3]
[stdout:0] 10
[stdout:1] 10
[stdout:2] 10
[stdout:3] 10
In [27]: %autopx
%autopx disabled
%cell_px [–no-verbose] [–verbose] [-t TARGETS] [-a] [-b] [-o SAVE_NAME] [–group-outputs {engine,order,type}] [-e] [-r]
Executes the cell in parallel.
Examples
In [24]: %%px --noblock
....: a = os.getpid()
Async parallel execution on engine(s): all
In [25]: %%px
....: print a
[stdout:0] 1234
[stdout:1] 1235
[stdout:2] 1236
[stdout:3] 1237
--no-verbose | don’t print any messages |
--verbose | print a message at each execution |
-t TARGETS, --targets TARGETS | |
specify the targets on which to execute | |
-a, --noblock | use non-blocking (async) execution |
-b, --block | use blocking (sync) execution |
-o SAVE_NAME, --out SAVE_NAME | |
store the AsyncResult object for this computation in the global namespace under this name. |
-e | group outputs by engine (same as group-outputs=engine) |
-r | collate outputs in order (same as group-outputs=order) |
Make an entry in the options_table for fn, with value optstr
Format a string for latex inclusion.
implementation used by %px and %%parallel
Parse options passed to an argument string.
The interface is similar to that of getopt(), but it returns back a Struct with the options as keys and the stripped argument string still as a string.
arg_str is quoted as a true sys.argv vector by using shlex.split. This allows us to easily expand variables, glob files, quote arguments, etc.
-mode: default ‘string’. If given as ‘list’, the argument string is returned as a list (split on whitespace) instead of a string.
-list_all: put all option values in lists. Normally only options appearing more than once are put in a list.
-posix (True): whether to split the input line in POSIX mode or not, as per the conventions outlined in the shlex module from the standard library.
Executes the given python command in parallel.
Examples
In [24]: %px a = os.getpid()
Parallel execution on engine(s): all
In [25]: %px print a
[stdout:0] 1234
[stdout:1] 1235
[stdout:2] 1236
[stdout:3] 1237
%pxconfig [–no-verbose] [–verbose] [-t TARGETS] [-a] [-b]
configure default targets/blocking for %px magics
--no-verbose | don’t print any messages |
--verbose | print a message at each execution |
-t TARGETS, --targets TARGETS | |
specify the targets on which to execute | |
-a, --noblock | use non-blocking (async) execution |
-b, --block | use blocking (sync) execution |
drop-in replacement for InteractiveShell.run_cell.
This executes code remotely, instead of in the local namespace.
See InteractiveShell.run_cell for details.
%result [-o SAVE_NAME] [–group-outputs {engine,order,type}] [-e] [-r]
Print the result of the last asynchronous %px command.
This lets you recall the results of %px computations after asynchronous submission (block=False).
Examples
In [23]: %px os.getpid()
Async parallel execution on engine(s): all
In [24]: %pxresult
Out[8:10]: 60920
Out[9:10]: 60921
Out[10:10]: 60922
Out[11:10]: 60923
-o SAVE_NAME, --out SAVE_NAME | |
store the AsyncResult object for this computation in the global namespace under this name. |
-e | group outputs by engine (same as group-outputs=engine) |
-r | collate outputs in order (same as group-outputs=order) |