Netflix / metaflow

:rocket: Build and manage real-life ML, AI, and data science projects with ease!

Home Page:https://metaflow.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strange inheritance behaviour of `FlowSpec`

sangwoo-joh opened this issue · comments

I have a base pipeline class, and two children that inherit this.
And the main calls one of them.

from metaflow import FlowSpec, step, Parameter

class Base(FlowSpec):
    base_param = Parameter("base-param")

class First(Base):
    first_param = Parameter("first")

class Second(Base):
    second_param = Parameter("second")


if __name__ == "__main__":
    Second()

When I ran second run --help, it strangely shows the first_param too!!!

python test.py run --help
Metaflow 2.9.11 executing Second for user:sangwoo-joh
Usage: test.py run [OPTIONS]

  Run the workflow locally.

Options:
  --base-param TEXT
  --first TEXT
  --second TEXT
...

How can this happen? What should I do?

Oh.. After I split First and Second into different files and created flow by importing this, it does show only the necessary parameters.
But I'm curious why this happens...

I believe it is due to this: https://github.com/Netflix/metaflow/blob/master/metaflow/parameters.py#L38. There is a comment saying we could fix it :).

@romain-intel Here is a PR to fix this: #1653

should be fixed now.