This module provides functionality for combining the EMA workbench with IPython parallel.

class ema_workbench.em_framework.ema_ipyparallel.Engine(engine_id, msis, cwd)

class for setting up ema specific stuff on each engine also functions as a convenient namespace for workbench relevant variables

  • engine_id (int) –
  • msis (list) –
  • cwd (str) –

remove the root working directory of the engine


run the experiment, the actual running is delegated to an ExperimentRunner instance

class ema_workbench.em_framework.ema_ipyparallel.EngingeLoggerAdapter(logger, topic)

LoggerAdapter that inserts EMA as a topic into log messages

  • logger (logger instance) –
  • topic (str) –
process(msg, kwargs)

Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.

Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.

class ema_workbench.em_framework.ema_ipyparallel.LogWatcher(**kwargs)

A simple class that receives messages on a SUB socket, as published by subclasses of zmq.log.handlers.PUBHandler, and logs them itself.

This can subscribe to multiple topics, but defaults to all topics.


receive and parse a message, then log it.


Update our SUB socket’s subscriptions.


cleanup directory tree structure on all engines


returns the engine ids by host

Parameters:client (IPython.parallel.Client instance) –
Returns:a dict with hostnames as keys, and a list of engine ids
Return type:dict
ema_workbench.em_framework.ema_ipyparallel.initialize_engines(client, msis, cwd)

initialize engine instances on all engines

  • client (IPython.parallel.Client) –
  • msis (dict) – dict of model structure interfaces with their names as keys
  • cwd (str) –

Updates EMA logging on the engines with an EngineLoggerAdapter This adapter injects EMA as a topic into all messages


convenience function for starting the LogWatcher

  • LogWatcher – the log watcher instance
  • Thread – the log watcher thread
  • .. note (there can only be one log watcher on a given url.)

updates the current working directory on the engines to point to the same working directory as this notebook

currently only works if engines are on same machine.

Parameters:client (IPython.parallel.Client instance) –