Skip to content

Commit 2d51ab5

Browse files
committed
Enable lazy pipeline mutations via recipe functions
1 parent 8e8e4be commit 2d51ab5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • pangeo_forge_runner/commands

pangeo_forge_runner/commands/bake.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def start(self):
261261

262262
# if pangeo-forge-recipes is <=0.9, we have to specify a requirements.txt
263263
# file even if it isn't present, as the image used otherwise will not have pangeo-forge-recipes
264-
if isinstance(recipe, PTransform):
264+
if isinstance(recipe, PTransform) or callable(recipe):
265265
requirements_path = feedstock.feedstock_dir / "requirements.txt"
266266
if requirements_path.exists():
267267
extra_options["requirements_file"] = str(requirements_path)
@@ -283,7 +283,9 @@ def start(self):
283283
# Chain our recipe to the pipeline. This mutates the `pipeline` object!
284284
# We expect `recipe` to either be a beam PTransform, or an object with a 'to_beam'
285285
# method that returns a transform.
286-
if isinstance(recipe, PTransform):
286+
if callable(recipe):
287+
recipe(pipeline)
288+
elif isinstance(recipe, PTransform):
287289
# This means we are in pangeo-forge-recipes >=0.9
288290
pipeline | recipe
289291
elif hasattr(recipe, "to_beam"):

0 commit comments

Comments
 (0)