Hi, while using baseflow pattern with flow mutator...
# ask-metaflow
f
Hi, while using baseflow pattern with flow mutators, I get some error. Details in 🧵
✅ 1
While having a hierarchy of baseflows as can be seen below in the code. It throws error about the
triggered_by
defined using flow mutator
Copy code
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?
Copy code
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()
Created an issue
a
thanks! cc @dry-beach-38304
d
I can check it out. Are you on the latest metaflow. There was an issue about this a little while ago.
Actually. It’s this PR. https://github.com/Netflix/metaflow/pull/2639. That should fix it for you.
🙌 1