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

Suggested changes for Pipeline planning of Duplicate/Remove #463

Conversation

reuterbal
Copy link
Collaborator

These are my suggested changes for #462, as mentioned. This looks like everything's different, but it is mostly moving conceptually things to different places and streamlining the implementation where necessary.

Importantly, I have moved the ItemFactory into a separate file as it was growing a bit. This is the first commit on this branch over #462: c1e9fc5

To properly assess the differences to @MichaelSt98's implementation, you may want to take a look at the diff against this commit: c1e9fc5...nabr-nams-pipeline-plan-duplicate-remove

Conceptually, this implements the following changes that I have also tried to keep in separate commits:

  1. Split the tests into planning and processing
  2. Fix proper deep-cloning for ProgramUnit and Sourcefile, and remove the recursive_clone method
  3. Move the injection of the dependency changes from the Item.dependency property into Item.create_dependency_items
  4. Move Item.clone into ItemFactory.get_or_create_item_from_item
  5. Apply relevant changes to DuplicateTrafo and RemoveTrafo
  6. Add a test that combines duplication and removal

Copy link

Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/463/index.html

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 93.00341% with 41 lines in your changes missing coverage. Please review.

Project coverage is 93.31%. Comparing base (3415e92) to head (fab1ce0).
Report is 12 commits behind head on nams-pipeline-plan-duplicate-remove.

Files with missing lines Patch % Lines
loki/batch/item_factory.py 86.05% 35 Missing ⚠️
loki/transformations/dependency.py 90.19% 5 Missing ⚠️
loki/sourcefile.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@                           Coverage Diff                           @@
##           nams-pipeline-plan-duplicate-remove     #463      +/-   ##
=======================================================================
+ Coverage                                93.27%   93.31%   +0.03%     
=======================================================================
  Files                                      223      224       +1     
  Lines                                    41674    41846     +172     
=======================================================================
+ Hits                                     38871    39048     +177     
+ Misses                                    2803     2798       -5     
Flag Coverage Δ
lint_rules 96.39% <ø> (ø)
loki 93.27% <93.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@MichaelSt98 MichaelSt98 left a comment

Choose a reason for hiding this comment

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

Really nice! And much better compared to my original implementation 👍

self.kernels = tuple(kernel.lower() for kernel in as_tuple(kernels))
self.duplicate_kernels = tuple(kernel.lower() for kernel in as_tuple(duplicate_kernels))

def _create_duplicate_items(self, successors, item_factory, config):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like this should be a (more generic) utility that lives outside of this transformation (at least in the future).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd agree here in principle, although this feels like it needs an Item.clone() method first and could/should possibly be done in a follow-up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

An Item.clone() is something we don't want, though - because you want that to always go through the factory.

Copy link
Collaborator

@mlange05 mlange05 left a comment

Choose a reason for hiding this comment

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

Looks great and adds some much needed structure. GTG from me.

self.kernels = tuple(kernel.lower() for kernel in as_tuple(kernels))
self.duplicate_kernels = tuple(kernel.lower() for kernel in as_tuple(duplicate_kernels))

def _create_duplicate_items(self, successors, item_factory, config):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd agree here in principle, although this feels like it needs an Item.clone() method first and could/should possibly be done in a follow-up.

@reuterbal reuterbal added the ready to merge This PR has been approved and is ready to be merged label Jan 9, 2025
@reuterbal reuterbal merged commit 9e3acce into nams-pipeline-plan-duplicate-remove Jan 9, 2025
13 checks passed
@reuterbal reuterbal deleted the nabr-nams-pipeline-plan-duplicate-remove branch January 9, 2025 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge This PR has been approved and is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants