-
Notifications
You must be signed in to change notification settings - Fork 9
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
Introduction of PackageWrapper & ResultWrapper #149
Conversation
For example, settings.input.blablabla... is now automatically converted into settings.specific[self.pkg_name].blablablabla...
* Updated the Sphinx ``conf.py`` settings. * Changed minimum Sphinx version to 2.1. * Added documentation for ``PackageWrapper``. * Added ``PackageWrapper`` to the main ``__init__.py`` file. * Added tests.
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.
For the record, Here is a conversion with @BvB93 about the reason to create these classes:
"There are more Job classes in PLAMS than the corresponding Package subclasses in QMFlows. Those could, of course, be implemented, but that can be a bit of work (which may or may not be worth it depending on the situation) Enter PackageWrapper, which is a Package subclass that can work with any arbitrary passed Job type, albeit in a more barebones fashion
Even though, when the passed Job type is recognized it will return the appropriate Package instance anyway upon calling the __call__
method For example ADFJob
will default to adf
, Cp2kJob
return cp2k
, etc.."
@@ -348,38 +359,44 @@ def generic2specific(self, settings: Settings, | |||
|
|||
specific_from_generic_settings = Settings() | |||
for k, v in settings.items(): | |||
if k != "specific": |
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.
Thanks for improving this mess!
HAS_ADF: bool = ADF_ENVIRON.issubset(os.environ.keys()) | ||
|
||
|
||
def _get_result(promised_object: PromisedObject, job: Type[Job]) -> Result: |
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.
Continuation of #149 (comment):
Thanks for the info, I'll get back to you a bit later.
Allright, I've created a way to (sort of) mock the ADF results.
More specifically, it creates a normal-ish qmflows.Result
instance and then attaches a pickled .dill file from a previous calculation.
See issue #147.
Major
PackageWrapper
andResultWrapper
subclasses.PackageWrapper
will take a singleplams.Job
type as argument and automatically return the appropiatePackage
instance upon callingPackageWrapper.__call__()
.Package.generic2specific()
to handle PLAMS style input settings.For example,
settings.input.blablabla
is now automatically converted intosettings.specific[self.pkg_name].blablabla
.Minor
Package.generic_dict_file
attribute from an instance- to a class-variable, as it's value is already constant with respect to the class type.Package.generic_dict_file
toNotImplemented
. Only applies to thePackage
baseclass, not its subclasses.Package.generic2specific()
.conf.py
settings.PackageWrapper
class.PackageWrapper
to the main__init__.py
file.init_restart()
andInitRestart
: only attempt to delete the newly created workdir if there is an actual previously existing workdir.