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

Keeping track of config state #79

Merged
merged 5 commits into from Oct 16, 2018
Merged

Keeping track of config state #79

merged 5 commits into from Oct 16, 2018

Conversation

znicholls
Copy link
Collaborator

@znicholls znicholls commented Jul 11, 2018

The persistance test I've put at the end fails when it shouldn't. The solution requires MAGICCBaseClass to somehow 'remember' its config so that when the diagnose_tcr_ecs method is called it doesn't overwrite the previous settings.

I'm not sure what the best solution is here. I feel like we could either:

  • add a _config property to MAGICCBaseClass

    • pros: in memory hence fast
    • cons: more places for config to hide
  • force the set_config routine to read in the current MAGTUNE_SIMPLE.CFG everytime it's called

    • pros: config in only one place
    • cons: reading and writing files is slow

Then I'm not sure what the behaviour should be:

  • if you're setting a previously unset variable, same as current
  • if you're setting a previously set variable should we have:
    • same as current (i.e. silent overwrite)
    • warning about overwriting (which could be silenced?)
    • something else?

Decided to just Jared's new API which does the job for us (setting previously set variable silently overwrites which I'm ok with as querying config is easy).

Show that keeping track of config state works

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Example added (either to an existing notebook or as a new notebook, where applicable)
  • Description in CHANGELOG.rst added

Adding to CHANGELOG.rst

Please add a single line in the changelog notes similar to one of the following:

- (`#XX <http://link-to-pr.com>`_) Added feature which does something
- (`#XX <http://link-to-pr.com>`_) Fixed bug identified in (`#XX <http://link-to-issue.com>`_)

@znicholls
Copy link
Collaborator Author

Once #136 goes through, we can use the update_config method and then start to hold config in memory, only writing to disk as part of run

@znicholls znicholls self-assigned this Oct 16, 2018
@znicholls znicholls changed the title WIP: Keeping track of config state Keeping track of config state Oct 16, 2018
@codecov-io
Copy link

codecov-io commented Oct 16, 2018

Codecov Report

Merging #79 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #79   +/-   ##
=======================================
  Coverage   96.85%   96.85%           
=======================================
  Files           4        4           
  Lines         889      889           
  Branches      123      123           
=======================================
  Hits          861      861           
  Misses         16       16           
  Partials       12       12
Impacted Files Coverage Δ
pymagicc/api.py 94.76% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db02a7e...638791c. Read the comment docs.

@rgieseke rgieseke merged commit fb8bd9c into master Oct 16, 2018
@rgieseke rgieseke deleted the persistant-config-state branch October 16, 2018 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants