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

Package management by context and handling of repackaging process #1729

Merged
merged 32 commits into from Apr 30, 2024

Conversation

nuclearkatie
Copy link
Contributor

@nuclearkatie nuclearkatie commented Apr 11, 2024

Copy link

github-actions bot commented Apr 11, 2024

Downstream Build Status Report - 7092890 - 2024-04-30 14:57:21 -0600

Build FROM cyclus_20.04_apt/cyclus
  • Cycamore: Success
  • Cymetric: Success
Build FROM cyclus_20.04_conda/cyclus
  • Cycamore: Success
  • Cymetric: Success
Build FROM cyclus_22.04_apt/cyclus
  • Cycamore: Success
  • Cymetric: Success
Build FROM cyclus_22.04_conda/cyclus
  • Cycamore: Success
  • Cymetric: Success

@coveralls
Copy link
Collaborator

coveralls commented Apr 11, 2024

Pull Request Test Coverage Report for Build 8901490530

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 77 of 84 (91.67%) changed or added relevant lines in 6 files are covered.
  • 5 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+8.2%) to 40.771%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/context.cc 3 4 75.0%
src/resource.h 9 10 90.0%
src/package.cc 17 22 77.27%
Files with Coverage Reduction New Missed Lines %
tests/toolkit/infile_converters_tests.cc 1 96.88%
src/package.cc 2 74.07%
build/cyclus/py_lib_.cxx 2 45.0%
Totals Coverage Status
Change from base Build 8680397273: 8.2%
Covered Lines: 53225
Relevant Lines: 130546

💛 - Coveralls

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

With apologies to another flip-flop (let's discuss) here are some otherwise minor comments.

src/resource.cc Outdated Show resolved Hide resolved
src/resource.cc Outdated Show resolved Hide resolved
src/resource.cc Outdated Show resolved Hide resolved
@nuclearkatie nuclearkatie changed the title move GetFillMass and PackageResource to resource class Package management by context and handling of repackaging process Apr 11, 2024
@nuclearkatie nuclearkatie marked this pull request as ready for review April 15, 2024 20:49
Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

I think the initialization of the unpackaged package in the context has gotten more complicated than it needs to... unless I'm forgetting something about how it all works.

src/context.cc Outdated Show resolved Hide resolved
src/package.cc Outdated Show resolved Hide resolved
src/package.cc Outdated Show resolved Hide resolved
src/package.cc Outdated Show resolved Hide resolved
src/material.cc Outdated

while (quantity() > pkg->fill_min()) {
double pkg_fill = std::min(quantity(), fill_mass);
m_pkgd = boost::dynamic_pointer_cast<Material>(ExtractRes(pkg_fill));
Copy link
Member

Choose a reason for hiding this comment

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

seems like this is the only line that really forces this method to be replicated 3 times... I'll have to dust off my C++ polymorphism to see if there's a better way...

src/package.h Outdated Show resolved Hide resolved
src/product.cc Outdated Show resolved Hide resolved
try singleton pattern for unpackaged
Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

One error here

src/package.h Outdated Show resolved Hide resolved
Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

Now that we've resolved the main design questions, a few final cleanup changes.

src/package.h Outdated Show resolved Hide resolved
src/context.h Outdated Show resolved Hide resolved
src/resource.cc Outdated Show resolved Hide resolved
src/resource.h Outdated Show resolved Hide resolved
src/product.h Outdated Show resolved Hide resolved
src/material.h Outdated Show resolved Hide resolved
nuclearkatie and others added 4 commits April 17, 2024 10:09
Co-authored-by: Paul Wilson <paul.wilson@wisc.edu>
Signed-off-by: Katie Mummah <radioactivekate@gmail.com>
Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

These comments have the fix for the current issue, but not sure what it will mean for nuances when we call these methods.

src/material.h Outdated Show resolved Hide resolved
src/product.h Outdated Show resolved Hide resolved
nuclearkatie and others added 4 commits April 22, 2024 08:45
Co-authored-by: Paul Wilson <paul.wilson@wisc.edu>
Signed-off-by: Katie Mummah <radioactivekate@gmail.com>
promote Package to parent class with templating
Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

Suggest a couple of additional tests.

// all packaged
std::vector<Product::Ptr> p1_pkgd = p1->Package<Product>(pkg);
EXPECT_EQ(p1->quantity(), 0);
EXPECT_EQ(p1_pkgd[0]->package_id(), pkg_id);
Copy link
Member

Choose a reason for hiding this comment

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

should we also check the number of packages? If I read this right, p1_pkgd should be length one: all of its 3 units of quantity in a single package.

We could also package p2 and its 7 units would end up in two packages of size 5 and 2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you'll never guess what was sitting forgotten in my stashes.... though I didn't I have the two packages case

src/context.h Outdated Show resolved Hide resolved
@gonuke gonuke merged commit ff37df4 into cyclus:main Apr 30, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants