@@ -52,6 +52,7 @@ def pipeline(_func: "F") -> "Pipeline": ...
5252def pipeline (
5353 * ,
5454 name : Optional [str ] = None ,
55+ dynamic : Optional [bool ] = None ,
5556 depends_on : Optional [List ["BaseStep" ]] = None ,
5657 enable_cache : Optional [bool ] = None ,
5758 enable_artifact_metadata : Optional [bool ] = None ,
@@ -79,6 +80,7 @@ def pipeline(
7980 _func : Optional ["F" ] = None ,
8081 * ,
8182 name : Optional [str ] = None ,
83+ dynamic : Optional [bool ] = None ,
8284 depends_on : Optional [List ["BaseStep" ]] = None ,
8385 enable_cache : Optional [bool ] = None ,
8486 enable_artifact_metadata : Optional [bool ] = None ,
@@ -106,6 +108,7 @@ def pipeline(
106108 _func: The decorated function.
107109 name: The name of the pipeline. If left empty, the name of the
108110 decorated function will be used as a fallback.
111+ dynamic: Whether this is a dynamic pipeline or not.
109112 depends_on: The steps that this pipeline depends on.
110113 enable_cache: Whether to use caching or not.
111114 enable_artifact_metadata: Whether to enable artifact metadata or not.
@@ -142,11 +145,30 @@ def pipeline(
142145 """
143146
144147 def inner_decorator (func : "F" ) -> "Pipeline" :
145- from zenml .pipelines .dynamic .pipeline_definition import DynamicPipeline
148+ if dynamic :
149+ from zenml .pipelines .dynamic .pipeline_definition import (
150+ DynamicPipeline ,
151+ )
146152
147- p = DynamicPipeline (
153+ PipelineClass = DynamicPipeline
154+
155+ pipeline_args = {
156+ "depends_on" : depends_on ,
157+ }
158+ else :
159+ from zenml .pipelines .pipeline_definition import Pipeline
160+
161+ PipelineClass = Pipeline
162+
163+ if depends_on :
164+ logger .warning (
165+ "The `depends_on` argument is not supported "
166+ "for static pipelines and will be ignored."
167+ )
168+ pipeline_args = {}
169+
170+ p = PipelineClass (
148171 name = name or func .__name__ ,
149- depends_on = depends_on ,
150172 entrypoint = func ,
151173 enable_cache = enable_cache ,
152174 enable_artifact_metadata = enable_artifact_metadata ,
@@ -167,6 +189,7 @@ def inner_decorator(func: "F") -> "Pipeline":
167189 substitutions = substitutions ,
168190 execution_mode = execution_mode ,
169191 cache_policy = cache_policy ,
192+ ** pipeline_args ,
170193 )
171194
172195 p .__doc__ = func .__doc__
0 commit comments