IPython Documentation

Table Of Contents

Previous topic

parallel.apps.ipcontrollerapp

Next topic

parallel.apps.iploggerapp

This Page

parallel.apps.ipengineapp

Module: parallel.apps.ipengineapp

Inheritance diagram for IPython.parallel.apps.ipengineapp:

The IPython engine application

Authors:

  • Brian Granger
  • MinRK

Classes

IPEngineApp

class IPython.parallel.apps.ipengineapp.IPEngineApp(**kwargs)

Bases: IPython.parallel.apps.baseapp.BaseParallelApplication

__init__(**kwargs)
aliases

An instance of a Python dict.

auto_create

A boolean (True, False) trait.

bind_kernel(**kwargs)

Promote engine to listening kernel, accessible to frontends.

builtin_profile_dir

A trait for unicode strings.

check_pid(pid)
classmethod class_config_section()

Get the config class config section

classmethod class_get_help(inst=None)

Get the help string for this class in ReST format.

If inst is given, it’s current trait values will be used in place of class defaults.

classmethod class_get_trait_help(trait, inst=None)

Get the help string for a single trait.

If inst is given, it’s current trait values will be used in place of the class default.

classmethod class_print_help(inst=None)

Get the help string for a single trait and print it.

classmethod class_trait_names(**metadata)

Get a list of all the names of this classes traits.

This method is just like the trait_names() method, but is unbound.

classmethod class_traits(**metadata)

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.

classes

An instance of a Python list.

clean_logs

A boolean (True, False) trait.

classmethod clear_instance()

unset _instance for this class and singleton parents.

cluster_id

A trait for unicode strings.

config

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.

config_file_name

A trait for unicode strings.

config_file_paths

An instance of a Python list.

config_file_specified

A boolean (True, False) trait.

config_files

An instance of a Python list.

copy_config_files

A boolean (True, False) trait.

crash_handler_class

alias of ParallelCrashHandler

created = None
description = 'Start an IPython engine for parallel computing.\n\nIPython engines run in parallel and perform computations on behalf of a client\nand controller. A controller needs to be started before the engines. The\nengine can be configured using command line options or using a cluster\ndirectory. Cluster directories contain config, log and security files and are\nusually located in your ipython directory and named as "profile_name".\nSee the `profile` and `profile-dir` options for details.\n'
examples = '\nipengine --ip=192.168.0.1 --port=1000 # connect to hub at ip and port\nipengine --log-to-file --log-level=DEBUG # log to a file with DEBUG verbosity\n'
excepthook(etype, evalue, tb)

this is sys.excepthook after init_crashhandler

set self.verbose_crash=True to use our full crashhandler, instead of a regular traceback with a short message (crash_handler_lite)

exit(exit_status=0)
extra_args

An instance of a Python list.

find_url_file()

Set the url file.

Here we don’t try to actually see if it exists for is valid as that is hadled by the connection logic.

flags

An instance of a Python dict.

flatten_flags()

flatten flags and aliases, so cl-args override as expected.

This prevents issues such as an alias pointing to InteractiveShell, but a config file setting the same trait in TerminalInteraciveShell getting inappropriate priority over the command-line arg.

Only aliases with exactly one descendent in the class list will be promoted.

forward_logging()
generate_config_file()

generate default config file from Configurables

get_pid_from_file()

Get the pid from the pid file.

If the pid file doesn’t exist a PIDFileError is raised.

init_config_files()

[optionally] copy default config files into profile dir.

init_crash_handler()

Create a crash handler, typically setting sys.excepthook to it.

init_engine()
init_mpi()
init_profile_dir()

initialize the profile dir

initialize(argv=None)
initialize_subcommand(subc, argv=None)

Initialize a subcommand with argv.

classmethod initialized()

Has an instance been created?

classmethod instance(*args, **kwargs)

Returns a global instance of this class.

This method create a new instance if none have previously been created and returns a previously created instance is one already exists.

The arguments and keyword arguments passed to this method are passed on to the __init__() method of the class upon instantiation.

Examples

Create a singleton class using instance, and retrieve it:

>>> from IPython.config.configurable import SingletonConfigurable
>>> class Foo(SingletonConfigurable): pass
>>> foo = Foo.instance()
>>> foo == Foo.instance()
True

Create a subclass that is retrived using the base class instance:

>>> class Bar(SingletonConfigurable): pass
>>> class Bam(Bar): pass
>>> bam = Bam.instance()
>>> bam == Bar.instance()
True
ipython_dir

A trait for unicode strings.

kernel

allow access to the Kernel object, so I look like IPKernelApp

kernel_app

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.

keyvalue_description

A trait for unicode strings.

load_config_file(suppress_errors=True)

Load the config file.

By default, errors in loading config are handled, and a warning printed on screen. For testing, the suppress_errors option is set to False, so errors will make tests fail.

load_connector_file()

load config from a JSON connector file, at a lower priority than command-line/config files.

log

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.

log_format

A trait for unicode strings.

log_level

An enum that whose value must be in a given sequence.

log_to_file

A boolean (True, False) trait.

log_url

A trait for unicode strings.

loop

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.

name = 'ipengine'
on_trait_change(handler, name=None, remove=False)

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

A callable that is called when a trait changes. Its signature can be handler(), handler(name), handler(name, new) or handler(name, old, new).

name : list, str, None

If None, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name.

remove : bool

If False (the default), then install the handler. If True then unintall it.

option_description

A trait for unicode strings.

overwrite

A boolean (True, False) trait.

parse_command_line(argv=None)

Parse the command line arguments.

print_alias_help()

Print the alias part of the help.

print_description()

Print the application description.

print_examples()

Print usage and examples.

This usage string goes at the end of the command line help string and should contain examples of the application’s usage.

print_flag_help()

Print the flag part of the help.

print_help(classes=False)

Print the help for each Configurable class in self.classes.

If classes=False (the default), only flags and aliases are printed.

print_options()
print_subcommands()

Print the subcommand part of the help.

print_version()

Print the version string.

profile

A trait for unicode strings.

reinit_logging()
remove_pid_file()

Remove the pid file.

This should be called at shutdown by registering a callback with reactor.addSystemEventTrigger(). This needs to return None.

stage_default_config_file()

auto generate default config file, and stage it into the profile.

start()
startup_command

A trait for unicode strings.

startup_script

A trait for unicode strings.

subapp

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.

subcommand_description

A trait for unicode strings.

subcommands

An instance of a Python dict.

to_work_dir()
trait_metadata(traitname, key)

Get metadata values for trait by key.

trait_names(**metadata)

Get a list of all the names of this classes traits.

traits(**metadata)

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_config(config)

Fire the traits events when the config is updated.

url_file

A trait for unicode strings.

url_file_name

A trait for unicode strings.

verbose_crash

A boolean (True, False) trait.

version

A trait for unicode strings.

wait_for_url_file

A float trait.

work_dir

A trait for unicode strings.

write_pid_file(overwrite=False)

Create a .pid file in the pid_dir with my pid.

This must be called after pre_construct, which sets self.pid_dir. This raises PIDFileError if the pid file exists already.

MPI

class IPython.parallel.apps.ipengineapp.MPI(**kwargs)

Bases: IPython.config.configurable.Configurable

Configurable for MPI initialization

__init__(**kwargs)

Create a configurable given a config config.

Parameters :

config : Config

If this is empty, default values are used. If config is a Config instance, it will be used to configure the instance.

Notes

Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():

class MyConfigurable(Configurable):
    def __init__(self, config=None):
        super(MyConfigurable, self).__init__(config)
        # Then any other code you need to finish initialization.

This ensures that instances will be configured properly.

classmethod class_config_section()

Get the config class config section

classmethod class_get_help(inst=None)

Get the help string for this class in ReST format.

If inst is given, it’s current trait values will be used in place of class defaults.

classmethod class_get_trait_help(trait, inst=None)

Get the help string for a single trait.

If inst is given, it’s current trait values will be used in place of the class default.

classmethod class_print_help(inst=None)

Get the help string for a single trait and print it.

classmethod class_trait_names(**metadata)

Get a list of all the names of this classes traits.

This method is just like the trait_names() method, but is unbound.

classmethod class_traits(**metadata)

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.

config

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.

created = None
default_inits

An instance of a Python dict.

init_script

A trait for unicode strings.

on_trait_change(handler, name=None, remove=False)

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

A callable that is called when a trait changes. Its signature can be handler(), handler(name), handler(name, new) or handler(name, old, new).

name : list, str, None

If None, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name.

remove : bool

If False (the default), then install the handler. If True then unintall it.

trait_metadata(traitname, key)

Get metadata values for trait by key.

trait_names(**metadata)

Get a list of all the names of this classes traits.

traits(**metadata)

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_config(config)

Fire the traits events when the config is updated.

use

A trait for unicode strings.

SimpleStruct

Function

IPython.parallel.apps.ipengineapp.launch_new_instance()

Create and run the IPython engine