Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case Recording Alpha #296

Merged
merged 204 commits into from
Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
d588b95
initial bare bones get something working
hschilling Mar 21, 2017
6cafc36
Merge branch 'master' of http://github.com/OpenMDAO/blue
Mar 21, 2017
43c3a38
added comments into the relevant areas of the code based on John's co…
hschilling Mar 23, 2017
7ce1fc5
bringing back options
Mar 23, 2017
1fba0fb
fixing merge
Mar 23, 2017
62e4a80
Merge branch 'master' of http://github.com/OpenMDAO/blue
Mar 23, 2017
82f2da3
test passing, encoding probs fixed, options added, _owners added to r…
Mar 27, 2017
85b4a8a
fixing the order of args to declare options so that options work prop…
Mar 28, 2017
6cf5c1d
removing extraneous print statements
Mar 28, 2017
19ef82c
getting startup hooked up between object/_rec_mgr/recorder
Mar 28, 2017
0177cf8
Merge branch 'master' of http://github.com/OpenMDAO/blue
Mar 29, 2017
b490841
using sqlite direct calls and numpy structured arrays
hschilling Mar 30, 2017
f38b6ac
close database
hschilling Mar 30, 2017
dc4cdd1
getting ready to merge in Herb's stuff
Mar 30, 2017
6508185
fixing up manual merge conflicts
Mar 30, 2017
e3efe17
Merge branch 'master' of http://github.com/OpenMDAO/blue
Mar 30, 2017
41b1409
setting up recording for all 3 types of objects
Apr 3, 2017
83e7ef4
fixing test fails and merge conflicts
Apr 3, 2017
61d3cee
Added beginnings of metadata
hschilling Apr 4, 2017
6fee221
merged in from Keith
hschilling Apr 4, 2017
e0fb8bd
cleaning up some things
Apr 4, 2017
710c0ad
adding metadata to db tables and db insert calls
Apr 4, 2017
f1f6866
small commit
Apr 4, 2017
d78aff3
working on getting test running with pyoptsparse
Apr 6, 2017
b0e84d2
Added code to case record pyoptsparsedriver
hschilling Apr 7, 2017
b95d268
Fixed conflicts and made sqlite recording more robust
hschilling Apr 7, 2017
2623db2
code cleanup of hundreds of pep/docstring failures
Apr 7, 2017
025de39
Initial sqlite case reader
hschilling Apr 7, 2017
671df6a
fix conflict
hschilling Apr 7, 2017
e470947
Initial case reader
hschilling Apr 7, 2017
6733675
fixing more Lint probs.
Apr 7, 2017
9f95d10
Added tests for case readers and many changes with how driver iterati…
hschilling Apr 11, 2017
4df4188
metadata system implementation, currently not working.
Apr 11, 2017
bec4575
fixing merge conflicts
Apr 11, 2017
11378d2
more recent updates, with pickling
Apr 13, 2017
ce77ce6
fixing merge conflicts
Apr 13, 2017
975eda2
refactoring sqlite reader tests
hschilling Apr 14, 2017
744b53c
have pyoptsparse test with sellar derivatives working
hschilling Apr 14, 2017
00b86ca
merge with herb
Apr 17, 2017
1a005d0
fixing more and more PEP problems
Apr 17, 2017
4e034d7
fixing merge conflicts with main
Apr 17, 2017
b27d423
Merge branch 'master' of http://github.com/OpenMDAO/blue
Apr 17, 2017
a5454cb
fixing merge conflicts and parallel test failures.
Apr 17, 2017
49f7326
refactoring assert iteration data
hschilling Apr 19, 2017
11b6016
adding in problem_viewer support for database reading of model data, …
Apr 19, 2017
795e041
changing tests and problem_viewer after discussion with Tomko
Apr 19, 2017
b2ca65e
Merge branch 'master' of http://github.com/OpenMDAO/blue
Apr 19, 2017
d899f3c
Started test for recording metadata
hschilling Apr 19, 2017
14441f8
merged out and fixed conflicts
hschilling Apr 19, 2017
66817ea
adjusting include/exclude lists
Apr 20, 2017
50a19ec
Merge branch 'blue_sqlite_recorder' of http://github.com/hschilling/blue
Apr 20, 2017
1a76ddb
added some recording metadata test
hschilling Apr 21, 2017
2d240d2
minor fixes
Apr 24, 2017
05b12e0
fix merge conflicts with Herb
Apr 24, 2017
7a4b644
fixing merge conflicts with main
Apr 24, 2017
ed7feef
Fixed problem with writing arrays to blobs in sqlite and also did som…
hschilling Apr 24, 2017
6e03358
Massive code cleanup
hschilling Apr 25, 2017
2d50d73
merged out
hschilling Apr 25, 2017
27074ba
latest new things
Apr 25, 2017
09fe794
merged with Herb and fixed conflicts
Apr 25, 2017
00ae93a
Merge branch 'master' of http://github.com/OpenMDAO/blue
Apr 25, 2017
106805d
small fixes
Apr 25, 2017
2d2f7a9
fixing up test for recording systems
hschilling Apr 26, 2017
7a08369
Merge remote-tracking branch 'keithfork/master' into blue_sqlite_reco…
hschilling Apr 26, 2017
2a79c13
fixing up the include/exclude listings for driver
May 1, 2017
45e209b
Added missing setups
hschilling May 1, 2017
5c2cd4e
Merge remote-tracking branch 'keithfork/master' into blue_sqlite_reco…
hschilling May 1, 2017
92be28a
Merge branch 'blue_sqlite_recorder' of http://github.com/hschilling/blue
May 2, 2017
b458018
merge with herb and main, fix conflicts
May 2, 2017
e18484d
moved system recording to _solve_nonlinear and _solve_linear
hschilling May 2, 2017
164659e
Fixes to recording of System
hschilling May 2, 2017
f60b9e4
fixing merge conflicts, but failing tests
May 2, 2017
d237058
Merge branch 'blue_sqlite_recorder' of http://github.com/hschilling/blue
May 2, 2017
60fbbbc
fixing fails and other conflicts and PEP8 stuff
May 2, 2017
e243cf2
fixed System recording test
hschilling May 2, 2017
1cd23c9
merging with herb
May 3, 2017
ec4e05a
fixed up building tuples for packing values into named arrays. Needed…
hschilling May 4, 2017
4218ec7
system filtering working
May 4, 2017
660a64a
merging in herb
May 4, 2017
f7aa8d8
fixing up merge issues
May 4, 2017
0a8dc07
Merge branch 'master' of http://github.com/OpenMDAO/blue
May 8, 2017
3316d67
Merge branch 'master' of http://github.com/OpenMDAO/blue
May 8, 2017
967d1a5
fixing problems with tests.
May 10, 2017
aece01a
Merge branch 'master' of http://github.com/OpenMDAO/blue
May 10, 2017
9431dff
changing up system recording, fixing tests
May 12, 2017
6c30250
fixing pep8
May 12, 2017
2fe423d
Merge branch 'master' of http://github.com/OpenMDAO/blue
May 12, 2017
cb58ae0
fixing bugs, adding mdf test
May 15, 2017
5987a59
fixed up solver recording for most cases, added a basic test
May 17, 2017
093c913
fixing merge conflicts
May 17, 2017
3bf5247
fixing further merge conflicts with blue/master
May 17, 2017
e490bb6
Merge branch 'master' of http://github.com/kmarsteller/blue
May 17, 2017
706b996
merges/conflicts
May 17, 2017
788eff1
fixing solver filtering
May 19, 2017
ff81a0c
Merge branch 'master' of http://github.com/OpenMDAO/blue
May 19, 2017
6f5fb9c
Added global counter across all iteration tables
hschilling May 21, 2017
a9a27fc
Added table to keep track of all the records across all the tables
hschilling May 21, 2017
09f28de
Merge pull request #11 from hschilling/blue_recording_global_counter
May 23, 2017
afaec88
new docstrings and cleanup
May 23, 2017
f663696
merge confilicts fixed
May 23, 2017
13bd26b
tweaks to recording linear solvers
hschilling May 23, 2017
d439789
fixing pep fails after herb merge
May 23, 2017
f4ce837
Merge pull request #12 from hschilling/blue_recording_global_counter
May 23, 2017
700a243
Merge branch 'master' of http://github.com/kmarsteller/blue
May 23, 2017
972ae35
cleaning up docstrings
May 24, 2017
0834eb4
Creating a rudimentary first doc for case recording.
May 24, 2017
7e57ca5
added tests for the recording of all Solvers
hschilling May 26, 2017
0c59aa1
Added more tests for solvers
hschilling Jun 5, 2017
a55324c
catching up with master
Jun 5, 2017
820f64d
fixing merge conflicts with herb
Jun 5, 2017
234bbc4
fixing conflicts
Jun 5, 2017
3d8031e
fixing conflicts
Jun 5, 2017
ef2dead
fixing more merge conflicts
Jun 5, 2017
f20d47a
fixing merge conflicts
Jun 7, 2017
d6527c2
Merge commit '55d22e2ed6edad4a6d7c12866023d9c501e0bafa' of http://git…
Jun 7, 2017
f27535b
Merge commit 'da9967ce20b7758c35d406148a114a306f4d703f' of http://git…
Jun 7, 2017
f4b5e66
fixing merge conflict, merging in Ken's stuff
Jun 7, 2017
4056313
Fixing all the recording tests that use Sellar after Ken's changes
Jun 8, 2017
0d24da2
Merge branch 'master' of http://github.com/OpenMDAO/blue
Jun 8, 2017
7e7016b
Fixed merge conflicts
hschilling Jun 12, 2017
0c98da5
Added implicit component test and have most of the iteration coordina…
hschilling Jun 14, 2017
9d18fda
Fixing problems in python 3.
Jun 15, 2017
46ee837
Merge branch 'master' of http://github.com/OpenMDAO/blue
Jun 15, 2017
4a6c9cb
fixing merge conflicts, and updating solver names in our own testing.
Jun 15, 2017
bc6511e
Cleaned up and fixed tests
hschilling Jun 15, 2017
08084b1
small change to test names
Jun 15, 2017
71218ad
Merge in of Herb's stuff, fixing merge conflicts.
Jun 15, 2017
ea596f1
fixing up things, cleaning up unlinted test files/util files.
Jun 16, 2017
06ffa22
removed debugging code
hschilling Jun 18, 2017
b38d55c
Merge remote-tracking branch 'keithfork/master' into sqlite_recorder_…
hschilling Jun 18, 2017
109357b
Fixed up case reader tests so they work again. Added test which tests…
hschilling Jun 19, 2017
f2f5714
cleaning up code tagged with the # TODO_RECORDER
hschilling Jun 19, 2017
da1825f
fixing iteration coord changes in tests, lint, other minor fixes
Jun 19, 2017
c401f0b
fixing merge conflict with master
Jun 19, 2017
336b57d
Added some more code to give iteration coordinates to more solvers
hschilling Jun 20, 2017
e0cbc45
Put back some code to temporarily set values for metadata variable th…
hschilling Jun 20, 2017
06550b6
starting to add real values to tests
Jun 20, 2017
084cdf2
Merge branch 'sqlite_recorder_almost_there' of http://github.com/hsch…
Jun 20, 2017
87b8a3b
fixing some solvers and updating their tests to look for real data va…
Jun 21, 2017
7f3817b
Merge branch 'master' of http://github.com/OpenMDAO/blue
Jun 21, 2017
237b996
fixing up tests more, adding new data, fixing import names
Jun 21, 2017
9acc28d
creating a context manager, removing old code and functions, changing…
Jun 23, 2017
9c2aef2
fixing everything but the _solve_nonlinear bug
Jun 26, 2017
214874a
passing tests
Jun 26, 2017
eaa5d78
intermediate commit with problems
Jun 27, 2017
2cae507
Moved from passing norm and norm0 to Recording context manager to pas…
hschilling Jun 28, 2017
c3b12ac
Merge branch 'master' of http://github.com/OpenMDAO/blue into recorde…
Jun 28, 2017
8c767b0
Fixed some expected values. They were very small but should have been…
hschilling Jun 28, 2017
13ada99
Merge branch 'fix_recorder_with_cm' of http://github.com/hschilling/b…
Jun 28, 2017
892790e
removing old cms, fixing pep probs, fixing circular imports, creating…
Jun 28, 2017
4d251e8
more cleanup of files
Jun 29, 2017
9606afb
fixes to get all tests passing
Jun 29, 2017
b9244fc
Merge pull request #15 from kmarsteller/recorder_with_cm
Jun 29, 2017
e5f51f1
final cleanup
Jun 30, 2017
1134b35
Merge branch 'master' of http://github.com/kmarsteller/blue
Jun 30, 2017
93bc36e
fixing up doc a little
Jun 30, 2017
c48ae20
fixing up doc a little
Jun 30, 2017
24086ad
fixing test name
Jun 30, 2017
85676f0
fixing some merge conflicts
Jul 6, 2017
5d2855a
fixing docs while out on this branch
Jul 6, 2017
facaff9
cleaning up some files
Jul 7, 2017
07a8b5c
fixing merge conflict with master
Jul 7, 2017
fa66ad5
Unnecessary code
hschilling Jul 9, 2017
9646b0e
Tweaked the way the metadata is written to sqlite
hschilling Jul 9, 2017
eab1c50
only the top level system had its metadata recorder. Need to recurse
hschilling Jul 9, 2017
ea82069
Added dumping out metadata
hschilling Jul 9, 2017
29da032
removed some commented out code
hschilling Jul 9, 2017
0796f3a
Completed implementing case reader and sqlite case reader code
hschilling Jul 9, 2017
797e798
Removed references to the 'new' versions of case reader code
hschilling Jul 9, 2017
6b2c3b5
Added code to test reading case records via the case key
hschilling Jul 9, 2017
54d525f
added some basic docs for case reading
hschilling Jul 9, 2017
a7d4c49
Merge branch 'sqlite_case_reader' of http://github.com/hschilling/blue
Jul 10, 2017
4402b35
fixing merge conflicts and pep failures
Jul 10, 2017
7ca9c49
big batch of fixes based on review. new docstrings, doc improvements,…
Jul 12, 2017
5c6d60a
Merge branch 'master' of http://github.com/OpenMDAO/blue
Jul 12, 2017
540ea8d
fixing merge conflict with master
Jul 12, 2017
3c9dde8
futher work on docs, docstrings, fixes from github review comments, a…
Jul 12, 2017
5d6c0a0
fixing pickle problems, more pep fixes, etc.
Jul 13, 2017
60c0672
fixing the pyoptsparse checking mechanism
Jul 14, 2017
99f3b61
fixing merge conflicts with master
Jul 14, 2017
9418f83
fixing up this devtool to work on both Pythons
Jul 14, 2017
9f3f3a7
First attempt at removing the inspect.stack calls that cause slow downs
hschilling Jul 17, 2017
2b47713
Fixed merge conflicts
hschilling Jul 17, 2017
45a0c96
No longer need to pass method name to record_system_iteration
hschilling Jul 17, 2017
b1f43b5
Working on improving the display of the metadata output in dump_sqlit…
hschilling Jul 17, 2017
5a2d2ca
merging in the stack fixes, pep fixes
Jul 17, 2017
bca720e
Changing Newton recording interval; adding warning about when to do a…
Jul 18, 2017
13a5042
Merge branch 'master' of http://github.com/OpenMDAO/blue
Jul 18, 2017
f8a276a
fixing merge conflicts and one script
Jul 25, 2017
6bfd5d5
conflicts resolved, but tests passing at /recorders level, not at /op…
Jul 27, 2017
d382c5e
fixing the stack bug
Jul 28, 2017
c1dc504
all tests pass
Kenneth-T-Moore Jul 28, 2017
0424f2f
Merge pull request #1 from Kenneth-T-Moore/failing_at_top
Jul 28, 2017
f6b0595
cleaning up, fixing tests
Jul 28, 2017
1be7912
fixing merge conflict
Jul 28, 2017
1d70138
Merge commit '4a8d469e75e0ab2e26f54174a31092ecd1c8c423' into failing_…
ryanfarr01 Jul 28, 2017
8430b3a
fixing merge with problem viewer
Jul 28, 2017
1845dfc
Viz tests now passing. Had to add sqlite logic back into problem_view…
ryanfarr01 Jul 28, 2017
70c03ea
Merge pull request #2 from ryanfarr01/fix_viz_tests_v2
Jul 28, 2017
d6590f3
Merge pull request #3 from ryanfarr01/fix_viz_tests_v2
Jul 28, 2017
4911653
fixing cpickle to cPickle typo
Jul 28, 2017
56ba386
last merge conflict with viewers
Jul 28, 2017
38786d6
Merge branch 'master' of http://github.com/kmarsteller/blue
Jul 28, 2017
281dc47
Merge branch 'master' of http://github.com/OpenMDAO/blue
Jul 28, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions openmdao/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
# System-Building Tools
from openmdao.utils.options_dictionary import OptionsDictionary

# Recorders
from openmdao.recorders.sqlite_recorder import SqliteRecorder

# set up tracing or memory profiling if env vars are set.
import os
if os.environ.get('OPENMDAO_TRACE'):
Expand Down
10 changes: 5 additions & 5 deletions openmdao/code_review/test_lint_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ def test_attributes(self):
if not found_in_pc:
new_failures.append('Member `{0}` not documented in Attributes section of own class or parent class docstrings'.format(v))
else:
if(print_info): print(" Documented member `%s`" % (v))
else: #no init section
if(len(classdoc_matches) == 0): # no Attributes section
if(print_info): print(' Skipping Class `%s`... missing Attributes and init' % (class_name))
else: # one Attributes section
if print_info: print(" Documented member `%s`" % (v))
else: # no init section
if len(classdoc_matches) == 0: # no Attributes section
if print_info: print(' Skipping Class `%s`... missing Attributes and init' % (class_name))
else: # one Attributes section
new_failures.append('Attributes section in docstring but no __init__ function')
if new_failures:
key = '{0}/{1}:{2}'.format(dir_name, file_name, class_name)
Expand Down
2 changes: 1 addition & 1 deletion openmdao/components/meta_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
from copy import deepcopy

from openmdao.api import ExplicitComponent
from openmdao.core.explicitcomponent import ExplicitComponent
from openmdao.surrogate_models.surrogate_model import SurrogateModel
from openmdao.utils.class_util import overrides_method

Expand Down
131 changes: 121 additions & 10 deletions openmdao/core/driver.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Define a base class for all Drivers in OpenMDAO."""

from six import iteritems

import numpy as np

from openmdao.utils.record_util import create_local_meta
from openmdao.utils.options_dictionary import OptionsDictionary
from openmdao.recorders.recording_manager import RecordingManager
from openmdao.recorders.recording_iteration_stack import Recording


class Driver(object):
Expand All @@ -15,6 +17,10 @@ class Driver(object):
----------
fail : bool
Reports whether the driver ran successfully.
iter_count : int
Keep track of iterations for case recording.
metadata : list
List of metadata
options : <OptionsDictionary>
Dictionary with general pyoptsparse options.
_problem : <Problem>
Expand All @@ -29,12 +35,18 @@ class Driver(object):
Contains all objective info.
_responses : dict
Contains all response info.
_rec_mgr : <RecordingManager>
Object that manages all recorders added to this driver.
_model_viewer_data : dict
Structure of model, used to make n2 diagram.
"""

def __init__(self):
"""
Initialize the driver.
"""
self._rec_mgr = RecordingManager()

self._problem = None
self._designvars = None
self._cons = None
Expand All @@ -53,11 +65,32 @@ def __init__(self):
self.supports.declare('gradients', type_=bool, default=False)
self.supports.declare('active_set', type_=bool, default=False)

self.iter_count = 0
self.metadata = None
self._model_viewer_data = None

# TODO, support these in Openmdao blue
self.supports.declare('integer_design_vars', type_=bool, default=False)

self.fail = False

def add_recorder(self, recorder):
"""
Add a recorder to the driver.

Parameters
----------
recorder : BaseRecorder
A recorder instance.
"""
self._rec_mgr.append(recorder)

def cleanup(self):
"""
Clean up resources prior to exit.
"""
self._rec_mgr.close()

def _setup_driver(self, problem):
"""
Prepare the driver for execution.
Expand All @@ -79,20 +112,42 @@ def _setup_driver(self, problem):
self._objs = model.get_objectives(recurse=True)
self._cons = model.get_constraints(recurse=True)

def get_design_var_values(self):
self._rec_mgr.startup(self)
if (self._rec_mgr._recorders):
from openmdao.devtools.problem_viewer.problem_viewer import _get_viewer_data
self._model_viewer_data = _get_viewer_data(problem)
self._rec_mgr.record_metadata(self)

def get_design_var_values(self, filter=None):
"""
Return the design variable values.

This is called to gather the initial design variable state.

Parameters
----------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the driver recorder uses this method? I guess that is okay, as long as the user is aware that this is the driver-scaled value. Still, that is probalby appropriate for recording on the driver. (same for cons and objs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, before we record, we're allowing the users to filter design vars (cons and objs too), using include/excludes. So before we record, we grab the values of only the ones that they want. Do you feel like we need to do something with the scaling here before we record? (We record scaling factors in driver metadata, for what that's worth.)

filter : list
List of desvar names used by recorders.

Returns
-------
dict
Dictionary containing values of each design variable.
"""
designvars = {}

if filter:
# pull out designvars of those names into filtered dict.
for inc in filter:
designvars[inc] = self._designvars[inc]

else:
# use all the designvars
designvars = self._designvars

vec = self._problem.model._outputs._views_flat
dv_dict = {}
for name, meta in iteritems(self._designvars):
for name, meta in iteritems(designvars):
scaler = meta['scaler']
adder = meta['adder']
indices = meta['indices']
Expand Down Expand Up @@ -138,10 +193,15 @@ def set_design_var(self, name, value):
if adder is not None:
desvar[indices] -= adder

def get_response_values(self):
def get_response_values(self, filter=None):
"""
Return response values.

Parameters
----------
filter : list
List of response names used by recorders.

Returns
-------
dict
Expand All @@ -150,18 +210,34 @@ def get_response_values(self):
# TODO: finish this method when we have a driver that requires it.
pass

def get_objective_values(self):
def get_objective_values(self, filter=None):
"""
Return objective values.

Parameters
----------
filter : list
List of objective names used by recorders.

Returns
-------
dict
Dictionary containing values of each objective.
"""
objectives = {}

if filter:
# pull out objectives of those names into filtered dict.
for inc in filter:
objectives[inc] = self._objs[inc]

else:
# use all the objectives
objectives = self._objs

vec = self._problem.model._outputs._views_flat
obj_dict = {}
for name, meta in iteritems(self._objs):
for name, meta in iteritems(objectives):
scaler = meta['scaler']
adder = meta['adder']
indices = meta['indices']
Expand All @@ -180,7 +256,7 @@ def get_objective_values(self):

return obj_dict

def get_constraint_values(self, ctype='all', lintype='all'):
def get_constraint_values(self, ctype='all', lintype='all', filter=None):
"""
Return constraint values.

Expand All @@ -194,15 +270,29 @@ def get_constraint_values(self, ctype='all', lintype='all'):
Default is 'all'. Optionally return just the linear constraints
with 'linear' or the nonlinear constraints with 'nonlinear'.

filter : list
List of objective names used by recorders.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this method in the doctstring, objective --> constraint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARGGGH, stupid copy/paste errors! Fixed locally.


Returns
-------
dict
Dictionary containing values of each constraint.
"""
constraints = {}

if filter is not None:
# pull out objectives of those names into filtered dict.
for inc in filter:
constraints[inc] = self._cons[inc]

else:
# use all the objectives
constraints = self._cons

vec = self._problem.model._outputs._views_flat
con_dict = {}

for name, meta in iteritems(self._cons):
for name, meta in iteritems(constraints):

if lintype == 'linear' and meta['linear'] is False:
continue
Expand Down Expand Up @@ -234,7 +324,6 @@ def get_constraint_values(self, ctype='all', lintype='all'):
# TODO: Need to get the allgathered values? Like:
# cons[name] = self._get_distrib_var(name, meta, 'constraint')
con_dict[name] = val

return con_dict

def run(self):
Expand All @@ -249,7 +338,11 @@ def run(self):
boolean
Failure flag; True if failed to converge, False is successful.
"""
return self._problem.model._solve_nonlinear()
with Recording(self._get_name(), self.iter_count, self) as rec:
failure_flag = self._problem.model._solve_nonlinear()

self.iter_count += 1
return failure_flag

def _compute_total_derivs(self, of=None, wrt=None, return_format='flat_dict',
global_names=True):
Expand Down Expand Up @@ -376,3 +469,21 @@ def get_req_procs(self, model):
max_procs can be None, indicating all available procs can be used.
"""
return model.get_req_procs()

def record_iteration(self):
"""
Record an iteration of the current Driver.
"""
metadata = create_local_meta(self._get_name())
self._rec_mgr.record_iteration(self, metadata)

def _get_name(self):
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a method instead of an attribute? I guess it's no big deal though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can switch if you'd prefer.

Get name of current Driver.

Returns
-------
str
Name of current Driver.
"""
return "Driver"