Inheritance diagram for IPython.parallel.client.view:
Views of remote engines.
Authors:
Bases: IPython.parallel.client.view.View
Direct Multiplexer View of one or more engines.
These are created via indexed access to a client:
>>> dv_1 = client[1]
>>> dv_all = client[:]
>>> dv_even = client[::2]
>>> dv_some = client[1:3]
This object provides dictionary access to engine namespaces:
# push a=5: >>> dv[‘a’] = 5 # pull ‘foo’: >>> db[‘foo’]
Abort jobs on my engines.
Parameters : | jobs : None, str, list of strs, optional
|
---|
Make this View active for parallel magic commands.
IPython has a magic command syntax to work with MultiEngineClient objects. In a given IPython session there is a single active one. While there can be many Views created and used by the user, there is only one active one. The active View is used whenever the magic commands %px and %autopx are used.
The activate() method is called on a given View to make it active. Once this has been done, the magic commands can be used.
calls f(*args, **kwargs) on remote engines, returning the result.
This method sets all apply flags via this View’s attributes.
calls f(*args, **kwargs) on remote engines in a nonblocking manner.
returns AsyncResult
A boolean (True, False) trait.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
Clear the remote namespaces on my engines.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Executes code on targets in blocking or nonblocking manner.
execute is always bound (affects engine namespace)
Parameters : | code : str
block : bool
|
---|
Gather a partitioned sequence on a set of engines as a single local seq.
get object(s) by key_s from remote namespace
see pull for details.
return one or more results, specified by history index or msg_id.
See client.get_result for details.
An instance of a Python list.
Parallel version of itertools.imap.
See self.map for details.
sync_imports(local=True) as a property.
See sync_imports for details.
Kill my engines.
view.map(f, *sequences, block=self.block) => list|AsyncMapResult
Parallel version of builtin map, using this View’s targets.
There will be one task per target, so work will be chunked if the sequences are longer than targets.
Results can be iterated as they are ready, but will become available in chunks.
Parameters : | f : callable
*sequences: one or more sequences of matching length :
block : bool
|
---|---|
Returns : | if block=False: :
else: :
|
Parallel version of builtin map, using this view’s engines.
This is equivalent to map(...block=False)
See self.map for details.
Parallel version of builtin map, using this view’s engines.
This is equivalent to map(...block=True)
See self.map for details.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
An instance of a Python set.
Decorator for making a ParallelFunction
get object(s) by name from remote namespace
will return one object if it is a key. can also take a list of keys, in which case it will return a list of objects.
Instruct the controller to forget specific results.
update remote namespace with dict ns
Parameters : | ns : dict
block : bool [default
|
---|
Fetch the Queue status of my engines
Decorator for making a RemoteFunction
An instance of a Python dict.
Execute contents of filename on my engine(s).
This simply reads the contents of the file and calls execute.
Parameters : | filename : str
targets : int/str/list of ints/strs
block : bool
|
---|
Partition a Python sequence and send the partitions to a set of engines.
set my attribute flags by keyword.
Views determine behavior with a few attributes (block, track, etc.). These attributes can be set all at once by name with this method.
Parameters : | block : bool
track : bool
|
---|
Terminates one or more engine processes, optionally including the hub.
spin the client, and sync
Context Manager for performing simultaneous local and remote imports.
‘import x as y’ will not work. The ‘as y’ part will simply be ignored.
If local=True, then the package will also be imported locally.
Note that remote-only (local=False) imports have not been implemented.
>>> with view.sync_imports():
... from numpy import recarray
importing recarray from numpy on engine(s)
temporarily set flags, for use in with statements.
See set_flags for permanent setting of flags
Examples
>>> view.track=False
...
>>> with view.temp_flags(track=True):
... ar = view.apply(dostuff, my_big_array)
... ar.tracker.wait() # wait for send to finish
>>> view.track
False
A boolean (True, False) trait.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
update remote namespace with dict ns
See push for details.
waits on one or more jobs, for up to timeout seconds.
Parameters : | jobs : int, str, or list of ints and/or strs, or one or more AsyncResult objects
timeout : float
|
---|---|
Returns : | True : when all msg_ids are done False : timeout reached, some msg_ids still outstanding |
Bases: IPython.parallel.client.view.View
An load-balancing View that only executes via the Task scheduler.
Load-balanced views can be created with the client’s view method:
>>> v = client.load_balanced_view()
or targets can be specified, to restrict the potential destinations:
>>> v = client.client.load_balanced_view([1,3])
which would restrict loadbalancing to between engines 1 and 3.
Abort jobs on my engines.
Parameters : | jobs : None, str, list of strs, optional
|
---|
calls f(*args, **kwargs) on remote engines, returning the result.
This method sets all apply flags via this View’s attributes.
calls f(*args, **kwargs) on remote engines in a nonblocking manner.
returns AsyncResult
A boolean (True, False) trait.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
return one or more results, specified by history index or msg_id.
See client.get_result for details.
An instance of a Python list.
Parallel version of itertools.imap.
See self.map for details.
view.map(f, *sequences, block=self.block, chunksize=1, ordered=True) => list|AsyncMapResult
Parallel version of builtin map, load-balanced by this View.
block, and chunksize can be specified by keyword only.
Each chunksize elements will be a separate task, and will be load-balanced. This lets individual elements be available for iteration as soon as they arrive.
Parameters : | f : callable
*sequences: one or more sequences of matching length :
block : bool [default self.block]
track : bool
chunksize : int [default 1]
ordered : bool [default True]
|
---|---|
Returns : | if block=False: :
|
Parallel version of builtin map, using this view’s engines.
This is equivalent to map(...block=False)
See self.map for details.
Parallel version of builtin map, using this view’s engines.
This is equivalent to map(...block=True)
See self.map for details.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
An instance of a Python set.
Decorator for making a ParallelFunction
Instruct the controller to forget specific results.
Fetch the Queue status of my engines
Decorator for making a RemoteFunction
An instance of a Python dict.
An integer trait.
Longs that are unnecessary (<= sys.maxint) are cast to ints.
set my attribute flags by keyword.
A View is a wrapper for the Client’s apply method, but with attributes that specify keyword arguments, those attributes can be set by keyword argument with this method.
Parameters : | block : bool
track : bool
after : Dependency or collection of msg_ids
follow : Dependency or collection of msg_ids
timeout : float/int or None
retries : int
|
---|
Terminates one or more engine processes, optionally including the hub.
spin the client, and sync
temporarily set flags, for use in with statements.
See set_flags for permanent setting of flags
Examples
>>> view.track=False
...
>>> with view.temp_flags(track=True):
... ar = view.apply(dostuff, my_big_array)
... ar.tracker.wait() # wait for send to finish
>>> view.track
False
A casting version of the float trait.
A boolean (True, False) trait.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
waits on one or more jobs, for up to timeout seconds.
Parameters : | jobs : int, str, or list of ints and/or strs, or one or more AsyncResult objects
timeout : float
|
---|---|
Returns : | True : when all msg_ids are done False : timeout reached, some msg_ids still outstanding |
Bases: IPython.utils.traitlets.HasTraits
Base View class for more convenint apply(f,*args,**kwargs) syntax via attributes.
Don’t use this class, use subclasses.
Methods : | spin :
wait :
execution methods :
data movement :
query methods :
control methods :
|
---|
Abort jobs on my engines.
Parameters : | jobs : None, str, list of strs, optional
|
---|
calls f(*args, **kwargs) on remote engines, returning the result.
This method sets all apply flags via this View’s attributes.
calls f(*args, **kwargs) on remote engines in a nonblocking manner.
returns AsyncResult
A boolean (True, False) trait.
Get a list of all the names of this classes traits.
This method is just like the trait_names() method, but is unbound.
Get a list of all the traits of this class.
This method is just like the traits() method, but is unbound.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
return one or more results, specified by history index or msg_id.
See client.get_result for details.
An instance of a Python list.
Parallel version of itertools.imap.
See self.map for details.
override in subclasses
Parallel version of builtin map, using this view’s engines.
This is equivalent to map(...block=False)
See self.map for details.
Parallel version of builtin map, using this view’s engines.
This is equivalent to map(...block=True)
See self.map for details.
Setup a handler to be called when a trait changes.
This is used to setup dynamic notifications of trait changes.
Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).
Parameters : | handler : callable
name : list, str, None
remove : bool
|
---|
An instance of a Python set.
Decorator for making a ParallelFunction
Instruct the controller to forget specific results.
Fetch the Queue status of my engines
Decorator for making a RemoteFunction
An instance of a Python dict.
set my attribute flags by keyword.
Views determine behavior with a few attributes (block, track, etc.). These attributes can be set all at once by name with this method.
Parameters : | block : bool
track : bool
|
---|
Terminates one or more engine processes, optionally including the hub.
spin the client, and sync
temporarily set flags, for use in with statements.
See set_flags for permanent setting of flags
Examples
>>> view.track=False
...
>>> with view.temp_flags(track=True):
... ar = view.apply(dostuff, my_big_array)
... ar.tracker.wait() # wait for send to finish
>>> view.track
False
A boolean (True, False) trait.
Get metadata values for trait by key.
Get a list of all the names of this classes traits.
Get a list of all the traits of this class.
The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.
This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.
waits on one or more jobs, for up to timeout seconds.
Parameters : | jobs : int, str, or list of ints and/or strs, or one or more AsyncResult objects
timeout : float
|
---|---|
Returns : | True : when all msg_ids are done False : timeout reached, some msg_ids still outstanding |
Keep our history and outstanding attributes up to date after a method call.
call spin after the method.
sync relevant results from self.client to our results attribute.