sqlite_recorder.py

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

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

Bases: openmdao.recorders.base_recorder.BaseRecorder

Recorder that saves cases in a sqlite db.

Attributes

model_viewer_data (dict) Dict that holds the data needed to generate N2 diagram.
con (sqlite connection object) Connection to the sqlite3 database.
cursor (sqlite cursor object) Sqlite3 system cursor via the con.
__init__(filepath, append=False)[source]

Initialize the SqliteRecorder.

Parameters:

filepath : str

Path to the recorder file.

append : bool

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

close()[source]

Close out.

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_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_driver(recording_requester)[source]

Record driver metadata.

Parameters:

recording_requester : Driver

The Driver 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.

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.