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

Add generator executor #238

Merged
merged 9 commits into from
Nov 29, 2021
Merged

Conversation

rabernat
Copy link
Contributor

This PR adds a .to_generator() method to the BaseRecipe class. It allows one to iterate through a recipe as follows:

rec = MyRecipe()
for function, args, kwargs in rec.to_generator():
    function(*args, **kwargs)

This will eventually replace the explicit mode of manual recipe execution and open the door to more flexible recipe patterns (e.g. #224).

@alxmrs
Copy link
Contributor

alxmrs commented Nov 20, 2021

Nice change! That's excellent that we can iterate through recipes one step at a time.

@rabernat rabernat mentioned this pull request Nov 29, 2021
@rabernat rabernat marked this pull request as ready for review November 29, 2021 16:50
@rabernat
Copy link
Contributor Author

I think I am going to merge this as it does not yet remove or deprecate any existing functionality, and it contains significant improvements to the testing and code organization.

In a follow-up PR, I will document this new feature and consider how to deprecate the old manual execution steps.

@rabernat rabernat merged commit 6b44109 into pangeo-forge:master Nov 29, 2021
@cisaacstern
Copy link
Member

👍 I am going to use this functionality to run pangeo-forge/staged-recipes#93 today and take notes for the follow-on documentation PR.

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

Successfully merging this pull request may close these issues.

3 participants