Skip to content

Commit

Permalink
Enable lazy pipeline mutations via recipe functions
Browse files Browse the repository at this point in the history
  • Loading branch information
moradology committed Feb 9, 2024
1 parent 8e8e4be commit 2d51ab5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pangeo_forge_runner/commands/bake.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def start(self):

# if pangeo-forge-recipes is <=0.9, we have to specify a requirements.txt
# file even if it isn't present, as the image used otherwise will not have pangeo-forge-recipes
if isinstance(recipe, PTransform):
if isinstance(recipe, PTransform) or callable(recipe):
requirements_path = feedstock.feedstock_dir / "requirements.txt"
if requirements_path.exists():
extra_options["requirements_file"] = str(requirements_path)
Expand All @@ -283,7 +283,9 @@ def start(self):
# Chain our recipe to the pipeline. This mutates the `pipeline` object!
# We expect `recipe` to either be a beam PTransform, or an object with a 'to_beam'
# method that returns a transform.
if isinstance(recipe, PTransform):
if callable(recipe):
recipe(pipeline)

Check warning on line 287 in pangeo_forge_runner/commands/bake.py

View check run for this annotation

Codecov / codecov/patch

pangeo_forge_runner/commands/bake.py#L287

Added line #L287 was not covered by tests
elif isinstance(recipe, PTransform):
# This means we are in pangeo-forge-recipes >=0.9
pipeline | recipe
elif hasattr(recipe, "to_beam"):
Expand Down

0 comments on commit 2d51ab5

Please sign in to comment.