sqlite_recorder.py

Class definition for SqliteRecorder, which provides dictionary backed by SQLite.

class openmdao.recorders.sqlite_recorder.SqliteRecorder(filepath, append=False, pickle_version=2, record_viewer_data=True)[source]

Bases: openmdao.recorders.case_recorder.CaseRecorder

Recorder that saves cases in a sqlite db.

Attributes

connection (sqlite connection object) Connection to the sqlite3 database.
__init__(filepath, append=False, pickle_version=2, record_viewer_data=True)[source]

Initialize the SqliteRecorder.

Parameters:
filepath : str

Path to the recorder file.

append : bool, optional

Optional. If True, append to an existing case recorder file.

pickle_version : int, optional

The pickle protocol version to use when pickling metadata.

record_viewer_data : bool, optional

If True, record data needed for visualization.

record_derivatives(recording_requester, data, metadata, **kwargs)

Route the record_derivatives call to the proper method.

Parameters:
recording_requester : object

System, Solver, Driver in need of recording.

data : dict

Dictionary containing derivatives keyed by ‘of,wrt’ to be recorded.

metadata : dict

Dictionary containing execution metadata.

**kwargs : keyword args

Some implementations of record_derivatives need additional args.

record_derivatives_driver(recording_requester, data, metadata)[source]

Record derivatives data from a Driver.

Parameters:
recording_requester : object

Driver in need of recording.

data : dict

Dictionary containing derivatives keyed by ‘of,wrt’ to be recorded.

metadata : dict

Dictionary containing execution metadata.

record_iteration(recording_requester, data, metadata, **kwargs)

Route the record_iteration call to the proper method.

Parameters:
recording_requester : object

System, Solver, Driver in need of recording.

metadata : dict, optional

Dictionary containing execution metadata.

data : dict

Dictionary containing desvars, objectives, constraints, responses, and System vars.

**kwargs : keyword args

Some implementations of record_iteration need additional args.

record_iteration_driver(recording_requester, data, metadata)[source]

Record data and metadata from a Driver.

Parameters:
recording_requester : object

Driver in need of recording.

data : dict

Dictionary containing desvars, objectives, constraints, responses, and System vars.

metadata : dict

Dictionary containing execution metadata.

record_iteration_problem(recording_requester, data, metadata)[source]

Record data and metadata from a Problem.

Parameters:
recording_requester : object

Problem in need of recording.

data : dict

Dictionary containing desvars, objectives, and constraints.

metadata : dict

Dictionary containing execution metadata.

record_iteration_solver(recording_requester, data, metadata)[source]

Record data and metadata from a Solver.

Parameters:
recording_requester : Solver

Solver in need of recording.

data : dict

Dictionary containing outputs, residuals, and errors.

metadata : dict

Dictionary containing execution metadata.

record_iteration_system(recording_requester, data, metadata)[source]

Record data and metadata from a System.

Parameters:
recording_requester : System

System in need of recording.

data : dict

Dictionary containing inputs, outputs, and residuals.

metadata : dict

Dictionary containing execution metadata.

record_metadata(recording_requester)

Route the record_metadata call to the proper method.

Parameters:
recording_requester : object

The object that would like to record its metadata.

record_metadata_solver(recording_requester)[source]

Record solver metadata.

Parameters:
recording_requester : Solver

The Solver that would like to record its metadata.

record_metadata_system(recording_requester)[source]

Record system metadata.

Parameters:
recording_requester : System

The System that would like to record its metadata.

record_viewer_data(model_viewer_data, key='Driver')[source]

Record model viewer data.

Parameters:
model_viewer_data : dict

Data required to visualize the model.

key : str, optional

The unique ID to use for this data in the table.

shutdown()[source]

Shut down the recorder.

startup(recording_requester)[source]

Prepare for a new run and create/update the abs2prom and prom2abs variables.

Parameters:
recording_requester : object

Object to which this recorder is attached.

openmdao.recorders.sqlite_recorder.array_to_blob(array)[source]

Make numpy array in to BLOB type.

Convert a numpy array to something that can be written to a BLOB field in sqlite.

TODO: move this to a util file?

Parameters:
array : array

The array that will be converted to a blob.

Returns:
blob :

The blob created from the array.

openmdao.recorders.sqlite_recorder.blob_to_array(blob)[source]

Convert sqlite BLOB to numpy array.

TODO: move this to a util file?

Parameters:
blob : blob

The blob that will be converted to an array.

Returns:
array :

The array created from the blob.

openmdao.recorders.sqlite_recorder.convert_to_list(vals)[source]

Recursively convert arrays, tuples, and sets to lists.

Parameters:
vals : numpy.array or list or tuple

the object to be converted to a list

Returns:
list :

The converted list.