-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix code for xps, xas, and update the code resources #711
Conversation
@@ -13,6 +13,21 @@ | |||
xch_elements = PSEUDO_TOC["xas_xch_elements"] | |||
|
|||
|
|||
def update_resources(builder, codes): |
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.
What if you use an extra function ?
def set_component_resources(component, code_info):
if code_info: # Ensure code_info is not None or empty
component.metadata.options.resources = {
"num_machines": code_info["nodes"],
"num_mpiprocs_per_machine": code_info["ntasks_per_node"],
"num_cores_per_mpiproc": code_info["cpus_per_task"],
}
if "parallelization" in code_info:
component.parallelization = orm.Dict(dict=code_info["parallelization"])
and then in update_resources , you call this function ?
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.
Actually , we are calling these lines plenty of times you can make like this function so it can be called by the other plugins , like ,
def update_resources(builder, codes):
# Update resources for 'scf.pw'
scf_pw_code_info = codes.get("pw")
if scf_pw_code_info:
set_component_resources(builder.core.scf.pw, scf_pw_code_info)
Then all the plugin can call this "util" function , set_component_resources ?? what do you think ?
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 the suggestions, we can do this for the moment. In the future, we better use the options
keyword to set up the resource when creating the builder.
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.
the thing with options is that is restricted to the workchain and if it has the options
, you rather use the override
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 agree that options
depends on how the plugin developer writes their WorkChain.
Thanks for the review. @AndresOrtegaGuerrero . I made the changes as you suggested. I tested |
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!
Update codes of plugin XAS and XPS:
xas
andxps
in the test