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

Ensemble.files refactor #746

Open
wants to merge 45 commits into
base: smartsim-refactor
Choose a base branch
from

Conversation

amandarichardsonn
Copy link
Contributor

@amandarichardsonn amandarichardsonn commented Oct 15, 2024

Attaching files to an Application and Ensemble has been refactored.

There is now two operations files, an operations.py file that holds the tools to attach files to an Application and an ensemble_operations.py file that holds the tools to attach files to an Ensemble. These two operation files are covered in individual test files: test_operations.py and test_ensemble_operations.py.

Additionally, building the file operation commands in the Generator has been refactored to support the removal of EntityFiles and replacement of the operations.FileSysOpSet. Tests for generator.py have been updated in test_generator.py.

Additionally, the function Ensemble._create_applications has been reworked to support the new Ensemble.files type.

Files to investigate:
smartsim/generation/operations/ensemble_operations.py
smartsim/generation/operations/operations.py
smartsim/generation/operations/utils/helpers.py
smartsim/builders/ensemble.py
smartsim/entity/application.py

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.79%. Comparing base (cce16e6) to head (f4e4cdb).
Report is 19 commits behind head on smartsim-refactor.

Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                  @@
##           smartsim-refactor     #746      +/-   ##
=====================================================
+ Coverage              40.45%   47.79%   +7.33%     
=====================================================
  Files                    110      109       -1     
  Lines                   7326     6576     -750     
=====================================================
+ Hits                    2964     3143     +179     
+ Misses                  4362     3433     -929     
Files with missing lines Coverage Δ
..._core/generation/operations/ensemble_operations.py 100.00% <100.00%> (ø)
smartsim/builders/ensemble.py 99.15% <100.00%> (ø)
smartsim/entity/application.py 90.00% <ø> (ø)

... and 11 files with indirect coverage changes

@amandarichardsonn
Copy link
Contributor Author

amandarichardsonn commented Oct 15, 2024

Question for @juliaputko ! In application.py you placed the TODO about 2 months ago in the remove dead attrs in application PR, is this safe to remove now?

# TODO: Remove this supression when we strip fileds/functionality
#       (run-settings/batch_settings/params_as_args/etc)!
# pylint: disable-next=too-many-public-methods

@amandarichardsonn amandarichardsonn marked this pull request as draft October 15, 2024 23:12
@amandarichardsonn amandarichardsonn changed the title Ensemble File refactor Ensemble.files refactor Oct 16, 2024
@amandarichardsonn amandarichardsonn marked this pull request as ready for review October 16, 2024 22:22
Copy link
Contributor

@juliaputko juliaputko left a comment

Choose a reason for hiding this comment

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

lookin great! You can also add a '''match="error message"''' to pytest to make sure you are failing on the right valueerror/type error that you are expecting. Up to you!

:param tag: Tag to use for find and replacement
"""
self.operations.append(
EnsembleConfigureOperation(src, file_parameters, dest, tag)
Copy link
Contributor

Choose a reason for hiding this comment

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

can we change the order of these so that it matches the configure method?

Copy link
Contributor

Choose a reason for hiding this comment

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

also I dont know if file_parameters is the best name for what is going in? This is a mapping of the items that need to be found and replaced right?

@@ -424,8 +431,8 @@ def build_jobs(self, settings: LaunchSettings) -> tuple[Job, ...]:
:raises TypeError: if the ids argument is not type LaunchSettings
:raises ValueError: if the LaunchSettings provided are empty
"""
if not isinstance(settings, LaunchSettings):
raise TypeError("ids argument was not of type LaunchSettings")
# if not isinstance(settings, LaunchSettings):
Copy link
Contributor

Choose a reason for hiding this comment

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

remove commented lines?


pytestmark = pytest.mark.group_a

# TODO missing test for _filter
Copy link
Contributor

Choose a reason for hiding this comment

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

address todo?

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.

2 participants