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__(self, filepath, append=False, pickle_version=2, record_viewer_data=True)[source]

Initialize the SqliteRecorder.

Parameters
filepathstr

Path to the recorder file.

appendbool, optional

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

pickle_versionint, optional

The pickle protocol version to use when pickling metadata.

record_viewer_databool, optional

If True, record data needed for visualization.

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

Route the record_derivatives call to the proper method.

Parameters
recording_requesterobject

System, Solver, Driver in need of recording.

datadict

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

metadatadict

Dictionary containing execution metadata.

**kwargskeyword args

Some implementations of record_derivatives need additional args.

record_derivatives_driver(self, recording_requester, data, metadata)[source]

Record derivatives data from a Driver.

Parameters
recording_requesterobject

Driver in need of recording.

datadict

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

metadatadict

Dictionary containing execution metadata.

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

Route the record_iteration call to the proper method.

Parameters
recording_requesterobject

System, Solver, Driver in need of recording.

metadatadict, optional

Dictionary containing execution metadata.

datadict

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

**kwargskeyword args

Some implementations of record_iteration need additional args.

record_iteration_driver(self, recording_requester, data, metadata)[source]

Record data and metadata from a Driver.

Parameters
recording_requesterobject

Driver in need of recording.

datadict

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

metadatadict

Dictionary containing execution metadata.

record_iteration_problem(self, recording_requester, data, metadata)[source]

Record data and metadata from a Problem.

Parameters
recording_requesterobject

Problem in need of recording.

datadict

Dictionary containing desvars, objectives, and constraints.

metadatadict

Dictionary containing execution metadata.

record_iteration_solver(self, recording_requester, data, metadata)[source]

Record data and metadata from a Solver.

Parameters
recording_requesterSolver

Solver in need of recording.

datadict

Dictionary containing outputs, residuals, and errors.

metadatadict

Dictionary containing execution metadata.

record_iteration_system(self, recording_requester, data, metadata)[source]

Record data and metadata from a System.

Parameters
recording_requesterSystem

System in need of recording.

datadict

Dictionary containing inputs, outputs, and residuals.

metadatadict

Dictionary containing execution metadata.

record_metadata(self, recording_requester)

Route the record_metadata call to the proper method.

Parameters
recording_requesterobject

The object that would like to record its metadata.

record_metadata_solver(self, recording_requester)[source]

Record solver metadata.

Parameters
recording_requesterSolver

The Solver that would like to record its metadata.

record_metadata_system(self, recording_requester)[source]

Record system metadata.

Parameters
recording_requesterSystem

The System that would like to record its metadata.

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

Record model viewer data.

Parameters
model_viewer_datadict

Data required to visualize the model.

keystr, optional

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

shutdown(self)[source]

Shut down the recorder.

startup(self, recording_requester)[source]

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

Parameters
recording_requesterobject

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
arrayarray

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
blobblob

The blob that will be converted to an array.

Returns
array :

The array created from the blob.