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

Functionalize out each condition from checkConditions #536

Merged
merged 3 commits into from
Feb 21, 2020

Conversation

sbenthall
Copy link
Contributor

See #534

In order to save on code duplication, I've functionalized out each condition from checkConditions.

# For theory, see hyperlink targets to expressions in
# url=http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory
# For example, the hyperlink to the relevant section of the paper
url='http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory'
Copy link
Member

Choose a reason for hiding this comment

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

this needs to be there @sbenthall as the variable url is referenced multiple times.

# For theory, see hyperlink targets to expressions in
# url=http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory
# For example, the hyperlink to the relevant section of the paper
url='http://econ.jhu.edu/people/ccarroll/papers/BufferStockTheory'
Copy link
Member

Choose a reason for hiding this comment

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

ah wait I see this here, other functions like checkGICInd also use the var url can you make it self.url so that references can be passed?

@llorracc
Copy link
Collaborator

@sbenthall, this looks great (but don't have time to review it now).

Key test will be whether it works as-is with BufferStockTheory, or whether BST needs to be revised (I'm guessing the latter).

@sbenthall
Copy link
Contributor Author

Tests pass with the current changes.
Any functionality that broke didn't have tests, but no change in functionality was intentional.

@MridulS I can fix that url variable issue tomorrow. thanks for catching it.

@MridulS
Copy link
Member

MridulS commented Feb 22, 2020 via email

@sbenthall
Copy link
Contributor Author

Any way you could link me to the Travis run of the DemARKs so I can see the errors there?

@sbenthall
Copy link
Contributor Author

Ok, @MridulS I've ran the DemARKs locally. That was a good idea.

#540 has fixes for the bugs that came up that seemed related to this PR.
I filed some other issues to the DemARK issue tracker for other things that came up.

In general:

  • I would much rather have pull request reviews before merging. I rushed this one because of the BST timing. I think it's always smoother if we plan these things out ahead of time.
  • Thanks @MridulS for catching the errors.
  • I think it's a problem if the only "test suite" we have takes so long to run that we can't even have Travis do it, so we have to run it locally instead. That's backwards!
  • I don't like the smell of the current code on this, and I think that the thing to do is to do a further refactor, with granular, fast tests in the HARK test suite, slated for the release following the immediate, urgent one.

@MridulS
Copy link
Member

MridulS commented Feb 24, 2020

  • I would much rather have pull request reviews before merging. I rushed this one because of the BST timing. I think it's always smoother if we plan these things out ahead of time.
  • I think it's a problem if the only "test suite" we have takes so long to run that we can't even have Travis do it, so we have to run it locally instead. That's backwards!

Yeah, I caught this because I keep a check on DemARKs with master HARK, we could add DemARK check before merging in anything to HARK master but as it takes some time to run the DemARK travis build we decided against it. Travis will happily run it but it just takes some time. You can run the DemARKs locally to test against changes to your local branch before issuing a PR by following this workflow

# install the updated HARK version in the current environment
$ pip install -e . 
# change to DemARK repo
$ cd path_to_demark
# run pytest
$ pytest --nbval-lax notebooks/

Especially when we are touching the model codebase we should make sure this one works out. This may not be the best way to getting this done but until we have proper unit testing framework this should be the way to go.

@llorracc
Copy link
Collaborator

llorracc commented Feb 24, 2020 via email

@sbenthall
Copy link
Contributor Author

Hmm. Ok.

@MridulS I didn't realize that pytest could work with notebooks in that way. Cool!
Is this workflow documented anywhere?

I think that in any case, it would be better if there were more automated tests in HARK that covered the functionality in DemARKs without having as long a runtime.
I've made a ticket for this here:

#542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants