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

Wangc/convert pp to interface #1508

Merged
merged 15 commits into from
Apr 22, 2021
Merged

Wangc/convert pp to interface #1508

merged 15 commits into from
Apr 22, 2021

Conversation

wangcj05
Copy link
Collaborator

@wangcj05 wangcj05 commented Apr 9, 2021


Pull Request Description

What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)

Restructure PostProcessor Entity and PostProcessor Interface. Let PostProcessor Entity inherit from Model, and PostProcessor Interface inherit form BaseInterface.
See #1486

Close #1529

What are the significant changes in functionality due to this change request?

For Change Control Board: Change Request Review

The following review must be completed by an authorized member of the Change Control Board.

  • 1. Review all computer code.
  • 2. If any changes occur to the input syntax, there must be an accompanying change to the user manual and xsd schema. If the input syntax change deprecates existing input files, a conversion script needs to be added (see Conversion Scripts).
  • 3. Make sure the Python code and commenting standards are respected (camelBack, etc.) - See on the wiki for details.
  • 4. Automated Tests should pass, including run_tests, pylint, manual building and xsd tests. If there are changes to Simulation.py or JobHandler.py the qsub tests must pass.
  • 5. If significant functionality is added, there must be tests added to check this. Tests should cover all possible options. Multiple short tests are preferred over one large test. If new development on the internal JobHandler parallel system is performed, a cluster test must be added setting, in XML block, the node <internalParallel> to True.
  • 6. If the change modifies or adds a requirement or a requirement based test case, the Change Control Board's Chair or designee also needs to approve the change. The requirements and the requirements test shall be in sync.
  • 7. The merge request must reference an issue. If the issue is closed, the issue close checklist shall be done.
  • 8. If an analytic test is changed/added is the the analytic documentation updated/added?
  • 9. If any test used as a basis for documentation examples (currently found in raven/tests/framework/user_guide and raven/docs/workshop) have been changed, the associated documentation must be reviewed and assured the text matches the example.

Copy link
Collaborator

@PaulTalbot-INL PaulTalbot-INL left a comment

Choose a reason for hiding this comment

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

A couple small comments, but this looks good otherwise. I'm sure this was tedious to convert; thanks for your effort!

framework/BaseClasses/BaseInterface.py Outdated Show resolved Hide resolved
framework/Models/PostProcessors/DataMining.py Show resolved Hide resolved
framework/Models/PostProcessors/PostProcessorInterface.py Outdated Show resolved Hide resolved
@wangcj05
Copy link
Collaborator Author

@PaulTalbot-INL I have resolved your comments. Thanks.

PaulTalbot-INL
PaulTalbot-INL previously approved these changes Apr 13, 2021
Copy link
Collaborator

@PaulTalbot-INL PaulTalbot-INL left a comment

Choose a reason for hiding this comment

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

Code changes approved. Continuing with the checklist ...

@PaulTalbot-INL
Copy link
Collaborator

With the HPC down this week, we're stuck waiting on the tests unless @alfoa green lights an alternate testing strategy. I only have access to OSX myself right now.

framework/Models/PostProcessor.py Outdated Show resolved Hide resolved
if Input is not None and len(Input) == 0:
Input = None
returnValue = (Input, self.run(Input))
ppInput = self.createNewInput(myInput,samplerType, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am conflicted here again. the samplerType is set at the Step stage...so for PostProcessor steps it will always be None. I dnk but I think it is not needed and it can cause confusion for the PostProcessor developer

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know it was there arleady, but probably it is a good time to remove it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree to remove it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have updated the docstring for better clarification. I think we can keep "samplerType" which will consistent with other Models at entity level. In addition, these methods will only at entity level, and we will not expose this method to post-processor developer. In other words, the pp developers will not see these methods, so there is no confusion for them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please open under discussion issue.

@@ -207,9 +210,9 @@ def submit(self,myInput,samplerType,jobHandler,**kwargs):
@ Out, None
"""
kwargs['forceThreads'] = True
Model.submit(self,myInput, samplerType, jobHandler,**kwargs)
super().submit(myInput, samplerType, jobHandler,**kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See above comment. In addition, 'samplerType' is needed, since we are calling the method from Model class.

Copy link
Collaborator

@alfoa alfoa Apr 21, 2021

Choose a reason for hiding this comment

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

See comment above. The samplerType should be encpasulated in the kwargs so usable by only the "entities" that need it.

framework/Models/PostProcessor.py Outdated Show resolved Hide resolved
framework/Models/PostProcessors/CrossValidation.py Outdated Show resolved Hide resolved
if output.type not in self.validDataType:
self.raiseAnError(IOError, 'Output type', str(output.type), 'is not allowed!')
evaluation = finishedJob.getEvaluation()
if isinstance(evaluation, Runners.Error):
Copy link
Collaborator

Choose a reason for hiding this comment

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

please open an issue. This "error" must be handled at the JobHandler level. We should not reach this point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see #1524

dims = outputRealization['dims']
else:
dims = {}
print(outputRealization.keys())
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed.

else:
dims = {}
print(outputRealization.keys())
output.load(outputRealization['data'], style='dict', dims=dims)
Copy link
Collaborator

Choose a reason for hiding this comment

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

the load should be modified to also accept a single realizaiton.

PS. I think that the PP must return a dataset. dictionaries are slow

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's have a discussion for this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

we can, but the "gate" (if statement) should be included in the load method

from .DataMining import QDataMining
additionalModules.append(QTopologicalDecomposition)
additionalModules.append(QDataMining)
except ImportError:
Copy link
Collaborator

Choose a reason for hiding this comment

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

please see PR #1503. These double imports are not needed. The only imports needed are in the Factory.py (it was supposed to be addressed in the PR #1480)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that observation came after that PR, right? Either way, I concur, I like the idea that classes are only available through the factories. This may require some standardization so we can check types consistently; previously we would import the module and check instance, such as

from Samplers import MonteCarlo
if isinstance(mySampler, MonteCarlo):
  ...

This might be harder with factories, but should be standardizable without checking against strings.

Copy link
Collaborator Author

@wangcj05 wangcj05 Apr 21, 2021

Choose a reason for hiding this comment

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

I have cleaned up the __init__.py file

@wangcj05
Copy link
Collaborator Author

@alfoa I have resolved your comments.

@alfoa
Copy link
Collaborator

alfoa commented Apr 22, 2021

Some regression test machines have connectivity issues currently under investigation by @joshua-cogliati-inl . The tests have been run locally and are green.

The PR is approved and can be merged.

@alfoa alfoa added the RAVENv2.1 All tasks and defects that will go in RAVEN v2.1 label Apr 22, 2021
@alfoa
Copy link
Collaborator

alfoa commented Apr 22, 2021

Checklist passed.

PR approved.

Merging

@alfoa alfoa merged commit f478787 into devel Apr 22, 2021
@alfoa alfoa deleted the wangc/convert_pp_to_interface branch April 22, 2021 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RAVENv2.1 All tasks and defects that will go in RAVEN v2.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Restructure PostProcessor based BaseEntity and BaseInterface Structure.
3 participants