Package openmdao.util

This package contains a number of utilities that are used inside of openmdao. It does not depend on any other openmdao package.

distutils_fix.py

Importing this file will fix problems we’ve found in distutils.

Current fixes are:

  1. Update the library_dir_option function in MSVCCompiler to add quotes around /LIBPATH entries.

dumpdistmeta.py

If run as main, dumpdistmeta.py will print out either a pretty-printed dict full of the metadata found in the specified distribution, or just the value of a single piece of metadata if metadata-item is specified on the command line. The distribution can be in the form of an installed egg, a zipped egg, or a gzipped tar file containing a distutils distribution.

usage: dumpdistmeta.py distribution [metadata-item]

Example output:

$ dumpdistmeta.py pyparsing-1.5.1-py2.5.egg
{'SOURCES': ['README',
             'pyparsing.py',
             'setup.py',
             'pyparsing.egg-info/PKG-INFO',
             'pyparsing.egg-info/SOURCES.txt',
             'pyparsing.egg-info/dependency_links.txt',
             'pyparsing.egg-info/top_level.txt'],
 'author': 'Paul McGuire',
 'author-email': 'ptmcg@users.sourceforge.net',
 'classifier': 'Programming Language :: Python',
 'dependency_links': [],
 'description': 'UNKNOWN',
 'download-url': 'http://sourceforge.net/project/showfiles.php?group_id=97203',
 'entry_points': {},
 'home-page': 'http://pyparsing.wikispaces.com/',
 'license': 'MIT License',
 'metadata-version': '1.0',
 'name': 'pyparsing',
 'platform': None,
 'py_version': '2.5',
 'summary': 'Python parsing module',
 'top_level': ['pyparsing'],
 'version': '1.5.1',
 'zip-safe': False}

Example output:

$ dumpdistmeta.py pyparsing-1.5.1-py2.5.egg license
MIT License
openmdao.util.dumpdistmeta.get_dist_metadata(dist, dirname='')

Retrieve metadata from within a distribution. Returns a dict.

openmdao.util.dumpdistmeta.get_metadata(path)

Retrieve metadata from the file or directory specified by path. path can be an installed egg, a zipped egg file, or a zipped or unzipped tar file of a python distutils or setuptools source distribution.

Returns a dict.

openmdao.util.dumpdistmeta.get_resource_files(dist, exList=None, incList=None, dirname='')

A generator that retrieves resource file pathnames from within a distribution.

eggloader.py

Egg loading utilities.

openmdao.util.eggloader.load(instream, fmt=4, package=None, logger=None)

Load object(s) from an input stream (or filename). If instream is a string that is not an existing filename or absolute path, then it is searched for using pkg_resources. Returns the root object.

openmdao.util.eggloader.load_from_eggfile(filename, entry_group, entry_name, install=False, logger=None, observer=None)

Extract files in egg to a subdirectory matching the saved object name. Optionally installs distributions the egg depends on, and then loads object graph state by invoking the given entry point. Returns the root object.

openmdao.util.eggloader.load_from_eggpkg(package, entry_group, entry_name, instance_name=None, logger=None, observer=None)

Load object graph state by invoking the given package entry point. Returns the root object.

openmdao.util.eggloader.check_requirements(required, logger=None, indent_level=0)

Display requirements (if logger debug level enabled) and note conflicts. Returns a list of unavailable requirements.

eggobserver.py

class openmdao.util.eggobserver.EggObserver(observer, logger)

Bases: object

Provides a convenient API for calling an observer of egg operations. observer will be called with:

  • ('analyze', filename, -1, -1) during module analysis.
  • ('add', filename, file_fraction, byte_fraction) while writing files.
  • ('copy', filename, file_fraction, byte_fraction) while copying files.
  • ('extract', filename, file_fraction, byte_fraction) while extracting files.
  • ('complete', egg_name, 1, 1) when complete.
  • ('except', message, -1, -1) when an exception occurs.
add(path, file_fraction, byte_fraction)

Observe add of file. If observer returns False, raises RuntimeError.

analyze(path)

Observe analysis of file. If observer returns False, raises RuntimeError.

complete(path)

Observe operation complete.

copy(path, file_fraction, byte_fraction)

Observe copy of file. If observer returns False, raises RuntimeError.

exception(msg)

Observe exception.

extract(path, file_fraction, byte_fraction)

Observe extraction of file. If observer returns False, raises RuntimeError.

eggsaver.py

Egg save utilities.

Note that pickle can’t save references to functions that aren’t defined at the top level of a module, and there doesn’t appear to be a viable workaround. Normally pickle won’t handle instance methods either, but there is code in place to work around that.

When saving to an egg, the module named __main__ changes when reloading. This requires finding the real module name and munging references to __main__. References to old-style class types can’t be restored correctly.

Also note that YAML format doesn’t handle more than one layer of back-pointers, so it’s only suitable for very flat object networks.

openmdao.util.eggsaver.save(root, outstream, fmt=4, proto=-1, logger=None)

Save the state of root and its children to an output stream (or filename). If outstream is a string, then it is used as a filename. The format can be supplied in case something other than cPickle is needed. For the pickle formats, a proto of -1 means use the highest protocol.

openmdao.util.eggsaver.save_to_egg(entry_pts, version=None, py_dir=None, src_dir=None, src_files=None, dst_dir=None, fmt=4, proto=-1, logger=None, use_setuptools=False, observer=None)

Save state and other files to an egg. Analyzes the objects saved for distribution dependencies. Modules not found in any distribution are recorded in an ‘egg-info/openmdao_orphans.txt’ file. Also creates and saves loader scripts for each entry point.

  • entry_pts is a list of (obj, obj_name, obj_group) tuples. The first of these specifies the root object and package name.
  • version defaults to a timestamp of the form ‘YYYY.MM.DD.HH.mm’.
  • py_dir is the (root) directory for local Python files. It defaults to the current directory.
  • src_dir is the root of all (relative) src_files.
  • dst_dir is the directory to write the egg in.
  • fmt and proto are passed to save().
  • If use_setuptools is True, then eggwriter.write_via_setuptools() is called rather than eggwriter.write().
  • observer will be called via an EggObserver intermediary.

Returns (egg_filename, required_distributions, orphan_modules).

eggwriter.py

Write Python egg files, either directly or via setuptools. Supports what’s needed for saving and loading components/simulations.

  • name must be an alphanumeric string.
  • version must be an alphanumeric string.
  • doc is used for the Summary and Description entries in the egg’s metadata.
  • entry_map is a pkg_resources EntryPoint map: a dictionary mapping group names to dictionaries mapping entry point names to EntryPoint objects.
  • src_files is a list of non-Python files to include.
  • distributions is a list of distributions this egg depends on. It is used for the Requires entry in the egg’s metadata.
  • modules is a list of modules not found in a distribution that this egg depends on. It is used for the Requires entry in the egg’s metadata and is also recorded in the ‘openmdao_orphans.txt’ resource.
  • dst_dir is the directory to write the egg to.
  • logger is the Logger object to use.
  • observer will be called via an EggObserver intermediary.
openmdao.util.eggwriter.egg_filename(name, version)

Returns name for egg file as generated by setuptools.

openmdao.util.eggwriter.write(name, version, doc, entry_map, src_files, distributions, modules, dst_dir, logger, observer=None, compress=True)

Write egg in the manner of setuptools, with some differences:

  • Writes directly to the zip file, avoiding some intermediate copies.
  • Doesn’t compile any Python modules.

Returns the egg’s filename.

openmdao.util.eggwriter.write_via_setuptools(name, version, doc, entry_map, src_files, distributions, modules, dst_dir, logger, observer)

Write an egg via setuptools. Returns the egg’s filename.

fileutil.py

Misc. file utility routines

openmdao.util.fileutil.copy(src, dest)

Copy a file or directory

openmdao.util.fileutil.find_bzr(path=None)

Return bzr root directory path, or None.

openmdao.util.fileutil.find_files(pat, startdir)

Return a list of files (using a generator) that match the given glob pattern. Walks an entire directory structure.

openmdao.util.fileutil.makepath(path)
creates missing directories for the given path and
returns a normalized absolute version of the path.
  • if the given path already exists in the filesystem the filesystem is not modified.
  • otherwise makepath creates directories along the given path using the dirname() of the path. You may append a ‘/’ to the path if you want it to be a directory path.

from holger@trillke.net 2002/03/18

openmdao.util.fileutil.rm(path)

Delete a file or directory

filewrap.py

Utilities for file wrapping

Note: This is a work in progress.

class openmdao.util.filewrap.FileParser

Bases: object

Utility to locate and read data from a file.

mark_anchor(anchor, occurrence=1)

Marks the location of a landmark, which lets you describe data by relative position. Note that a forward search begins at the old anchor location. If you want to restart the search for the anchor at the file beginning, then call reset_anchor() before mark_anchor.

anchor: The text you want to search for

occurence: find nth instance of text; default is 1 (first). Use -1 to find last occurence. Reverse searches always start at the end of the file no matter the state of any previous anchor.

reset_anchor()

Resets anchor to the beginning of the file.

set_delimiters(delimiter)

Lets you change the delimiter that is used to identify field boundaries.

set_file(filename)

Set the name of the file that will be generated.

transfer_array(rowstart, fieldstart, rowend=None, fieldend=None)

Grabs an array of variables relative to the current anchor.

transfer_keyvar(key, field, occurrence=1, rowoffset=0)

Searches for a key relative to the current anchor, and then grabs a field from that line.

field – Which field to transfer. Field 0 is the key

occurrence – find nth instance of text; default is 1 (first value field). Use -1 to find last occurence. Position 0 is the key field, so it should not be used as a value for occurrence.

rowoffset – Optional row offset from the occurrence of key. This can also be negative

You can do the same thing with a call to mark_anchor and transfer_var. This function just combines them for convenience.

transfer_line(row)

Returns a whole line, relative to current anchor.

row - number of lines offset from anchor line (0 is anchor line). This can be negative.

transfer_var(row, field, fieldend=None)

Grabs a single variable relative to the current anchor.

— If the delimiter is ” ” —

row - number of lines offset from anchor line (0 is anchor line). This can be negative.

field - which word in line to retrieve

fieldend - IGNORED

— If the delimiter is “columns” —

row - number of lines offset from anchor line (0 is anchor line). This can be negative.

field - character position to start

fieldend - position of last character to return

class openmdao.util.filewrap.InputFileGenerator

Bases: object

Utility to generate an input file from a template. Substitution of values is supported. Data is located with a simple API.

clearline(row)

Replace the contents of a row with the newline character.

row - row number to clear, relative to current anchor

generate()

Use the template file to generate the input file.

mark_anchor(anchor, occurrence=1)

Marks the location of a landmark, which lets you describe data by relative position.

anchor: text to search for

occurence: find nth instance of text; default is 1 (first). Use -1 to find last occurence.

reset_anchor()

Resets anchor to the beginning of the file.

set_delimiters(delimiter)

Lets you change the delimiter that is used to identify field boundaries.

set_generated_file(filename)

Set the name of the file that will be generated.

set_template_file(filename)

Set the name of the template file to be used.

transfer_2Darray(value, row_start, row_end, field_start, field_end, sep=', ')

Changes the values of a 2D array in the template relative to the current anchor. This method is specialized for 2D arrays, where each row of the array is on its own line.

value - array of values to insert

row_start - Starting row for inserting the array. This is relative to the anchor, and can be negative

row_end - Final row for the array, relative to the anchor

field_start - starting field in the given row_start as denoted by delimiter(s).

field_end - the final field the array uses in row_end. We need this to figure out if the template is too small or large

sep - Optional. Separator to use if we go beyond the template

transfer_array(value, row_start, field_start, field_end, row_end=None, sep=', ')

Changes the values of an array in the template relative to the current anchor. This should generally be used for one-dimensional or free form arrays.

value - array of values to insert

row_start - starting row for inserting the array. This is relative to the anchor, and can be negative

field_start - starting field in the given row_start as denoted by delimiter(s).

field_end - the final field the array uses in row_end. We need this to figure out if the template is too small or large

row_end - Optional. Use if the array wraps to cover additional lines

sep - Optional. Separator to use if we go beyond the template

transfer_var(value, row, field)

Changes a single variable in the template relative to the current anchor.

row - number of lines offset from anchor line (0 is anchor line). This can be negative.

field - which word in line to replace, as denoted by delimiter(s)

class openmdao.util.filewrap.ToFloat(expr, savelist=False)

Bases: pyparsing.TokenConverter

Converter to make token into a float.

postParse(instring, loc, tokenlist)
class openmdao.util.filewrap.ToInteger(expr, savelist=False)

Bases: pyparsing.TokenConverter

Converter to make token into an integer.

postParse(instring, loc, tokenlist)

filexfer.py

openmdao.util.filexfer.filexfer(src_server, src_path, dst_server, dst_path, mode='')

Transfer a file from one place to another.

If src_server or dst_server is None, then the os module is used for the source or destination respectively. Otherwise the respective object must support open(), stat(), and chmod().

mode specifies any open() mode settings in addition to ‘r’ or ‘w’.

After the copy has completed, permission bits from stat() are set via chmod().

openmdao.util.filexfer.pack_zipfile(patterns, filename, logger=<class 'openmdao.util.log.NullLogger'>)

Create ‘zip’ file filename of files in patterns. Returns (nfiles, nbytes).

openmdao.util.filexfer.unpack_zipfile(filename, logger=<class 'openmdao.util.log.NullLogger'>)

Unpack ‘zip’ file filename. Returns (nfiles, nbytes).

grab_distrib.py

openmdao.util.grab_distrib.grab_distrib(req, index=None, dest='.', search_pypi=True)

Downloads a distribution from the given package index(s) based on the given requirement string(s). Downloaded distributions are placed in the specified destination or the current directory if no destination is specified. If a distribution cannot be found in the given index(s), the Python Package Index will be searched as a last resort unless search_pypi is False. This does NOT install the distribution.

Requirements may be supplied as strings or as Requirement objects.

log.py

This is just a wrapper for the logging module. Messages can be routed to the console via enable_console(). If the file ‘logger.cfg’ exists, it can be used to configure logging. See the Python documentation for logging.config for details. The example below is equivalent to calling enable_console():

[loggers]
keys=root

[handlers]
keys=consoleHandler

[formatters]
keys=consoleFormatter

[logger_root]
level=DEBUG
handlers=consoleHandler

[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=consoleFormatter
args=(sys.stderr,)

[formatter_consoleFormatter]
format=%(levelname)s %(name)s: %(message)s
openmdao.util.log.getLogger(name)

Return the named logger.

openmdao.util.log.enable_console()

Configure logging to receive log messages at the console.

openmdao.util.log.disable_console()

Stop receiving log messages at the console.

class openmdao.util.log.Logger(name, level=None)

Bases: object

Pickle-able logger. Mostly a pass-through to a real logger.

critical(msg, *args, **kwargs)

Log a critical message.

debug(msg, *args, **kwargs)

Log a debug message.

error(msg, *args, **kwargs)

Log an error message.

info(msg, *args, **kwargs)

Log an information message.

level

Logging message level.

log(level, msg, *args, **kwargs)

Log a message at a specified level.

rename(name)

Change name reported in log.

warning(msg, *args, **kwargs)

Log a warning message.

class openmdao.util.log.NullLogger

Bases: object

Can be useful when no logger has been supplied to a routine. It produces no output.

critical(msg, *args, **kwargs)

Log a critical message.

debug(msg, *args, **kwargs)

Log a debug message.

error(msg, *args, **kwargs)

Log an error message.

info(msg, *args, **kwargs)

Log an information message.

log(msg, *args, **kwargs)

Log a message at a specified level.

warning(msg, *args, **kwargs)

Log a warning message.

mdo.py

Math related utility functions used by OpenMDAO.

openmdao.util.mdo.rand_latin_hypercube(n, k, edges=False)

Calculates a random latin hypercube set of n points in k dimensions within [0,1]^k hypercube.

n : int
desired number of points
k : int
number of design variables (dimensions)
edges : bool, optional
if Edges=True the extreme bins will have their centres on the edges of the domain, otherwise the bins will be entirely contained within the domain (default setting).

Returns an n by k numpy array.

mod2dist.py

A script to package into a distribution a single module containing OpenMDAO plugin classes. The script imports the module in order to determine its contents, so all dependencies must be on sys.path.

exception openmdao.util.mod2dist.Mod2DistError(msg, parser=None)

Bases: exceptions.RuntimeError

openmdao.util.mod2dist.mod2dist(argv=None, groups={'openmdao.variable': <class 'enthought.traits.trait_handlers.TraitType'>, 'openmdao.driver': <class 'openmdao.main.driver.Driver'>, 'openmdao.component': <class 'openmdao.main.component.Component'>})

Utility to simplify the packaging of a single module containing OpenMDAO plugin classes into a source distribution.

Use mod2dist -h to see all of the options.

The only required options are the desired version of the distribution and the module to use to generate the distribution. For example:

mod2dist -v 1.0 simple_adder.py

namelist_util.py

Utilities for reading and writing FORTRAN namelists.

class openmdao.util.namelist_util.Card(name, value, is_comment=0)

Bases: object

Data object that stores the value of a single card for a namelist.

class openmdao.util.namelist_util.Namelist(comp)

Bases: object

Utility to ease the task of constructing a formatted output file

add_comment(comment)

Add a comment in the namelist.

add_container(varpath)

Add every variable in an OpenMDAO container to the namelist.

add_group(name)

Add a new group to the namelist. Any variables added after this are added to this new group.

add_newvar(name, value)

Add a new private variable to the namelist.

add_var(varpath)

Add an openmdao variable to the namelist. varpath is the dotted path (e.g., comp1.comp2.var1)

generate()

Create the input file.

set_filename(filename)

Set the name of the file that will be generated or parsed.

set_title(title)

Sets the title for the namelist

parse_phoenixwrapper.py

Parses the variable definition section of a Phoenix Integration ModelCenter component wrapper.

openmdao.util.parse_phoenixwrapper.parse_phoenixwrapper(infile, outfile, compname)

Generates a dummy component given a Phoenix Integration Modelcenter script wrapper. The first section of this wrapper is parsed, and the appropriate variables and containers are placed in the new OpenMDAO component.

infile - ModelCenter scriptwrapper outfile - file containing new OpenMDAO component skeleton compname - Name for new component

plot.py

Utility functions related to plotting data

openmdao.util.plot.case_db_to_dict(dbname, varnames, case_sql=None, var_sql=None)

Retrieve the values of specified variables from a sqlite DB containing Case data.

Returns a dict containing a list of values for each entry, keyed on variable name.

dbname : str
The name of the sqlite DB file
varnames : list[str]
The list of names of variables to be retrieved
case_sql : str, optional
SQL syntax that will be placed in the WHERE clause for Case retrieval
var_sql : str, optional
SQL syntax that will be placed in the WHERE clause for variable retrieval
openmdao.util.plot.cmdlineXYplot()

Based on command line options, display an XY plot using data from a sqlite Case DB.

openmdao.util.plot.displayXY(dbname, xnames, ynames, case_sql=None, var_sql=None, title='', grid=False, xlabel='', ylabel='')

Display an XY plot using Case data from a sqlite DB.

dbname : str
Name of the database file
xnames : list[str]
Names of X variables
ynames : list[str]
Names of Y variables
case_sql : str, optional
SQL syntax that will be placed in the WHERE clause for Case retrieval
var_sql : str, optional
SQL syntax that will be placed in the WHERE clause for variable retrieval
title : str, optional
Plot title
grid : bool, optional
If True, a grid is drawn on the plot
xlabel : str, optional
X axis label
ylabel : str, optional
Y axis label

procutil.py

openmdao.util.procutil.run_command(cmd, sh=True)

run a command using Popen and return its output (stdout and stderr) and its return code as a tuple.

openmdao.util.procutil.traceit(frame, event, arg)

a function useful for tracing python execution. wherever you want the tracing to start, insert a call to sys.settrace(traceit)

shellproc.py

exception openmdao.util.shellproc.CalledProcessError(returncode, cmd, errormsg)

Bases: subprocess.CalledProcessError

subprocess.CalledProcessError plus errormsg attribute.

class openmdao.util.shellproc.ShellProc(args, stdin=None, stdout=None, stderr=None, env=None)

Bases: subprocess.Popen

A slight modification to subprocess.Popen. Sets the shell argument True, updates a copy of os.environ with env, and opens files for any stream which is a basestring.

close_files()

Closes files that were implicitly opened.

wait(poll_delay=0.0, timeout=0.0)

Polls for command completion or timeout. Closes any files implicitly opened. Returns (return_code, error_msg).

openmdao.util.shellproc.call(args, stdin=None, stdout=None, stderr=None, env=None, poll_delay=0.0, timeout=0.0)

Run command with arguments. Returns (return_code, error_msg).

openmdao.util.shellproc.check_call(args, stdin=None, stdout=None, stderr=None, env=None, poll_delay=0.0, timeout=0.0)

Run command with arguments. If non-zero return_code, raises CalledProcessError.

stream.py

class openmdao.util.stream.Stream(file_obj, binary=False, big_endian=False, single_precision=False, integer_8=False, unformatted=False, recordmark_8=False)

Bases: object

Wrapper of standard Python file object. Supports reading/writing int and float arrays in various formats.

  • file_obj is a file object opened for reading or writing.
  • If binary, the data is in binary, not text, form.
  • If big_endian, the data bytes are in ‘big-endian’ order. Only meaningful if binary.
  • If single_precision, floating-point data is 32 bits, not 64. Only meaningful if binary.
  • If integer_8, integer data is 64 bits, not 32. Only meaningful if binary.
  • If unformatted, the data is surrounded by Fortran record length markers. Only meaningful if binary.
  • If recordmark_8, the record length markers are 64 bits, not 32. Only meaningful if unformatted.
read_float(full_record=False)

Returns next float. If full_record, then read surrounding recordmarks. Only meaningful if unformatted.

read_floats(shape, order='C', full_record=False)

Returns floats as a numpy array of shape. If full_record, then read surrounding recordmarks. Only meaningful if unformatted.

read_int(full_record=False)

Returns next integer. If full_record, then read surrounding recordmarks. Only meaningful if unformatted.

read_ints(shape, order='C', full_record=False)

Returns integers as a numpy array of shape. If full_record, then read surrounding recordmarks. Only meaningful if unformatted.

read_recordmark()

Returns value of next recordmark.

reclen_floats(count)

Returns record length for count floats.

reclen_ints(count)

Returns record length for count ints.

write_array(data, order='C', sep=' ', fmt='%s', linecount=0)

Writes numpy array data as text. If order is ‘C’, the data is written in row-major order. If order is ‘Fortran’, the data is written in column-major order. If linecount is > zero, then at most linecount values are written per line.

write_float(value, sep=' ', fmt='%s', full_record=False)

Writes a float. If full_record, then write surrounding recordmarks. Only meaningful if unformatted.

write_floats(data, order='C', sep=' ', fmt='%s', linecount=0, full_record=False)

Writes numpy float array data. If order is ‘C’, the data is written in row-major order. If order is ‘Fortran’, the data is written in column-major order. If linecount is > zero, then at most linecount values are written per line. If full_record, then write surrounding recordmarks. Only meaningful if unformatted.

write_int(value, sep=' ', fmt='%s', full_record=False)

Writes an integer. If full_record, then write surrounding recordmarks. Only meaningful if unformatted.

write_ints(data, order='C', sep=' ', fmt='%s', linecount=0, full_record=False)

Writes numpy integer array data. If order is ‘C’, the data is written in row-major order. If order is ‘Fortran’, the data is written in column-major order. If linecount is > zero, then at most linecount values are written per line. If full_record, then write surrounding recordmarks. Only meaningful if unformatted.

write_recordmark(length)

Writes recordmark for length record.

testutil.py

openmdao.util.testutil.assertRaisesError(test_case_instance, code, err_type, err_msg)

Determine that code raises err_type with err_msg.

openmdao.util.testutil.assert_raises(test_case, code, globals, locals, exception, msg, use_exec=False)

Determine that code raises exception with msg. globals and locals are arguments for eval(). If use_exec, then evaluate code with exec rather than eval(). This is necessary for testing statements that are not expressions.

openmdao.util.testutil.assert_rel_error(test_case, actual, desired, tolerance)

Determine that the relative error between actual and desired is within tolerance.

openmdao.util.testutil.find_python()

Return path to the OpenMDAO python command

openmdao.util.testutil.make_protected_dir()

Returns the the absolute path of an inaccessible directory. Files cannot be created in it, it can’t be os.chdir() to, etc. Not supported on Windows.

view_docs.py

openmdao.util.view_docs.view_docs(browser=None)

A script (openmdao_docs) points to this. It just pops up a browser to view the openmdao sphinx docs. If the docs are not already built, it builds them before viewing, but if the docs already exist, it’s not smart enough to rebuild them if they’ve changed since the last build.

If this is run from a non-developer install, i.e., there is no local copy of the docs, it just looks for the docs on the openmdao.org website.

wrkpool.py

class openmdao.util.wrkpool.WorkerPool

Bases: object

Pool of worker threads, grows as necessary.

static cleanup()

Cleanup resources (worker threads).

static get()

Get a worker queue from the pool. Work requests should be of the form:

(callable, *args, **kwargs, reply_queue)

Work replies are of the form:

(queue, retval, exc, traceback)

static get_instance()

Return singleton instance.

static release(queue)

Release a worker queue back to the pool.