-
Notifications
You must be signed in to change notification settings - Fork 120
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
Add to_ixmp4()
method
#797
Add to_ixmp4()
method
#797
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #797 +/- ##
=======================================
+ Coverage 94.6% 94.8% +0.1%
=======================================
Files 62 64 +2
Lines 6040 6089 +49
=======================================
+ Hits 5719 5775 +56
+ Misses 321 314 -7 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Just one potential issues that I'd see.
What if an error occurs between lines 2347 and 2351?
This way we could end up in a situation where a run is created and no data are added.
Or data are added but the run isn't set as default.
@meksor is more qualified to speak on this but I wonder if it's possible to wrap this entire operation in a try...except
clause and roll back the changes in the data base in case anything goes wrong.
Nice catch, @phackstock. A roll-back is not possible in ixmp4 (because the creation of a run and adding of a run are separate actions), and there is no possibility (yet) to delete a run., but I'll add a to-do. |
Ah I see, then the quick fix might be to still use a try except and delete the whole run if we encounter an error. Just to avoid having half finished ghost runs. |
Added an issue to delete runs in ixmp4, see iiasa/ixmp4#29. Added a quickfix and tests to at least test for the obvious failures... Once this PR is merged, I'll add a method |
6288e3d
to
7374f14
Compare
7374f14
to
7c30d97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me in principle.
Some minor comments and questions in line.
Please confirm that this PR has done the following:
Name of contributors Added to AUTHORS.rstDescription of PR
This PR adds a method
to_ixmp4()
to easily save all scenarios in an IamDataFrame (including meta indicators) to an ixmp4 platform database instance.The method name
to_ixmp4()
doesn't seem elegant, any alternative suggestions of comments?