-
Notifications
You must be signed in to change notification settings - Fork 80
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
Entos: Added entos engine #82
Conversation
Hmm probably should have realized |
|
Okay so I've begun adding |
You'll want to add jinja to whichever one of the devools/conda-envs/ you'd like to "test" the templating for. The setup* files can wait, as they don't actually get run for dependencies in the usual workflow. |
I'm not sure which one of the devtools/conda-envs to add to? Should I just add it to the |
You could make a new one and add a new test in the |
I'd be happy to do that too. I know we potentially plan to expand the use of |
…ck to test_entos.py)
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.
Cool! Thanks for the start on this.
qcengine/programs/entos.py
Outdated
# } | ||
|
||
# Perform substitution to create input file | ||
str_template = jinja2.Template(template) |
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.
Something I was curious about is if we truly need jinja here, it seems our template are simple enough that they can be handled via more canonical means like finding {{molecule}}
fields. I think my original suggestion may be been slightly optimistic towards the range of capabilities we could code in.
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.
I like the idea of having a template and then being able to do a dictionary substitute. I know the string.Template
module offers some support of this, but it is very limited. I think we can provide the range of capabilities we discussed with jinja2, but it'll take some tinkering to be sure.
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.
Absolutely, jinja will totally cover our use case. But the question is do we need it? string.Template
provides fairly reaching functionality.
Or even writing our own using {{method}}
with double bracket replacement.
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.
I suppose what I didn't like about string.Template
is that I couldn't find a way for it to tell me what fields are present which would then need to be filled. I'd like that functionality so we can be flexible in what information is required from the user in the input.json
. It's possible that we could write our own but is it more trouble than it's worth? Is this mostly so we wouldn't need to have QCEngine be dependent on jinja2
for something that is probably fairly simple?
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.
Pretty much, we try to keep the dependancies as small as possible for our lower level libraries and code small extra bits where needed.
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.
Okay so what is the way forward on this? @dgasmith I can switch over to using string.Template
for now to keep the functionality I've added and to remove the jinja dependency, but I don't think this PR should include writing our own version of templating.
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.
I would vote to delay the jinja integration unless absolutely necessary. Lets work through this in the slack channel to figure out what we need.
properties["scf_dipole_moment"] = [float(x) for x in fields[2:5]] | ||
elif fields[:3] == ["SCF", "converged", "in"]: | ||
properties["scf_iterations"] = int(fields[3]) | ||
elif fields == ["Gradient", "(hartree/bohr):"]: |
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.
Since Entos is new, I don't suppose we could convince them to drop JSON output or even CSV?
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.
They are in the process of writing their output in XML and/or JSON. It isn't currently done, but once it is I'll update the output parser.
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.
Overall this LGTM. If we can pop out the jinja stuff I think we should be ready to go.
result = self.parse_output(proc["outfiles"], input_data) | ||
return result | ||
|
||
def execute(self, inputs, extra_outfiles=None, extra_commands=None, scratch_name=None, timeout=None): |
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.
Can you add typing info here from the base harness?
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.
There is no typing info currently for the execute function from the base harness.
This pull request introduces 1 alert when merging d9a2fea into b8fbf02 - view on LGTM.com new alerts:
|
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.
LGTM
Is this ready to go or are there other changes desired? |
This should be all good to go! |
In we go then! |
I've added entos as an engine. It includes all functions to be run by
qcng.compute()
and the ability to runentos.build_input()
,entos.execute()
, andentos.parse_output()
. I've begun adding support for using Jinja templates so we can cover the different ways might want to provide custom template files.(A) ordinary build_input (need to define a base template)
(B) user wants to add stuff after normal template (A)
(C) user knows their domain language (doesn't use any QCSchema quantities)
Right now it only supports option (C). Also right now the output parser does text parsing, but this will be removed eventually since entos plans to output all of their results to a xml or json format.