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

Bug risk: Using customize_funcs() with Dask to update the parameters of a @flow or @subflow #1865

Open
Andrew-S-Rosen opened this issue Mar 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Andrew-S-Rosen
Copy link
Member

Andrew-S-Rosen commented Mar 9, 2024

Details about the quacc environment

  • quacc version: 0.6.10+
  • Python version: 3.11

What is the issue?

def update_parameters(
func: Callable,
params: dict[str, Any],
decorator: Literal["job", "flow", "subflow"] | None = "job",
) -> Callable:
"""
Update the parameters of a (potentially decorated) function.
Parameters
----------
func
The function to update.
params
The parameters and associated values to update.
decorator
The decorator associated with `func`.
Returns
-------
Callable
The updated function.
"""
from quacc import SETTINGS, flow, job, subflow
if decorator and SETTINGS.WORKFLOW_ENGINE == "dask":
if decorator == "job":
decorator = job
elif decorator == "flow":
decorator = flow
elif decorator == "subflow":
decorator = subflow
func = strip_decorator(func)
return decorator(partial(func, **params))
return partial(func, **params)

When calling customize_funcs() with the update_parameters keyword argument, the user can update the parameters of any @job, @flow, or @subflow. In most cases, this is a @job. However, if the object we are updating the parameters of is a @flow or @subflow, it won't be properly updated when using Dask unless we pass the decorator keyword argument to update_parameters which seems very easy to forget.

@Andrew-S-Rosen Andrew-S-Rosen added the bug Something isn't working label Mar 9, 2024
@Andrew-S-Rosen Andrew-S-Rosen changed the title Bug risk: Using customize_funcs() with Dask to update the parameters of a @flow or @subflow is messy Bug risk: Using customize_funcs() with Dask to update the parameters of a @flow or @subflow is prone to error Mar 9, 2024
@Andrew-S-Rosen Andrew-S-Rosen changed the title Bug risk: Using customize_funcs() with Dask to update the parameters of a @flow or @subflow is prone to error Bug risk: Using customize_funcs() with Dask to update the parameters of a @flow or @subflow Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant