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: append_name for Flows generated as a Response #639

Closed
JaGeo opened this issue Jul 3, 2024 · 4 comments
Closed

BUG: append_name for Flows generated as a Response #639

JaGeo opened this issue Jul 3, 2024 · 4 comments

Comments

@JaGeo
Copy link
Member

JaGeo commented Jul 3, 2024

I am trying to implement a more complex workflow (see materialsproject/atomate2#903). I need to renae jobs to work on the corresponding tests.

from jobflow import job, Flow, Response, run_locally


@job
def my_function(my_parameter: int) -> int:
    return my_parameter


@job
def my_second_function(my_parameter: int) -> int:
    job2 = my_function(my_parameter)
    return Response(replace=Flow(job2))


job3 = my_second_function(2)
job3.append_name(" test")
run_locally(job3)

This results in

2024-07-03 15:40:30,217 INFO Started executing jobs locally
2024-07-03 15:40:30,337 INFO Starting job - my_second_function test (bfde76e4-b636-416b-9fb9-ada2577f7377)
2024-07-03 15:40:30,339 INFO Finished job - my_second_function test (bfde76e4-b636-416b-9fb9-ada2577f7377)
2024-07-03 15:40:30,339 INFO Starting job - my_function (653a9993-4c4e-4332-9321-0f50ce985a55)
2024-07-03 15:40:30,340 INFO Finished job - my_function (653a9993-4c4e-4332-9321-0f50ce985a55)
2024-07-03 15:40:30,340 INFO Finished executing jobs locally

Is there another way to rename that I am overlooking? I would have hoped that "my_function" also gets renamed.

@davidwaroquiers
Copy link
Contributor

Hi @JaGeo

Not sure if it is a bug but at least it is definitely a use case. Somehow what's missing is the dynamic application of the append procedure, similar to e.g. what is done with update_metadata (in which there is a dynamic argument, by default True).

I'll let @utf comment on this but it seems reasonable to add this feature.

@utf
Copy link
Member

utf commented Jul 3, 2024

I agree with @davidwaroquiers, we could add a dynamic option as we did here:

dynamic
The updates will be propagated to Jobs/Flows dynamically generated at
runtime.

@JaGeo
Copy link
Member Author

JaGeo commented Jul 3, 2024

@utf @davidwaroquiers adding a dynamic option would be great and would help with solving my issue.

@davidwaroquiers
Copy link
Contributor

I guess it would be good (and more consistent) to also add the same filtering options. Should then this stay within append_name or be a new update_name method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants