fast-vr-44972
11/06/2025, 11:34 AMfast-vr-44972
11/06/2025, 11:37 AMtriggered_by defined using flow mutator
Flow failed:
Flow 'FlowGrandChild' already has a class member 'triggered_by' -- set overwrite=True in add_parameter to overwrite it.
This is the code which reproduces it. Is this a bug or I am doing something wrong?
from __future__ import annotations
from metaflow import (
FlowMutator,
Parameter,
FlowSpec,
step,
)
from metaflow.user_decorators.mutable_flow import MutableFlow
class TriggeredByParameter(FlowMutator):
def pre_mutate(self, mutable_flow: MutableFlow):
mutable_flow.add_parameter(
"triggered_by",
Parameter(
"triggered_by",
default="ci-cd",
type=str,
help="Username of the user triggering the flow",
),
)
@TriggeredByParameter()
class BaseFlow(FlowSpec):
def dummy_method(self):
pass
class BaseFlowChild(BaseFlow):
def child_method(self):
pass
class FlowGrandChild(BaseFlowChild):
"""Final Flow."""
msg: list[str] = Parameter( # type: ignore
"msg",
type=str,
help="Error message to log",
)
@step
def start(self):
print("BaseFlowError:", self.msg)
self.next(self.end)
@step
def end(self):
pass
if __name__ == "__main__":
FlowGrandChild()fast-vr-44972
11/06/2025, 12:49 PMancient-application-36103
11/06/2025, 2:57 PMdry-beach-38304
11/06/2025, 3:56 PMdry-beach-38304
11/06/2025, 4:00 PM