I'm one of the folks who has been asking Metaflow ...
# dev-metaflow
l
I'm one of the folks who has been asking Metaflow for a functional interface. I'm collecting a few examples to illustrate why. I'd love comments in this thread. cc: @bored-vr-66208 , @rich-scientist-42991 Here's a table of a few use cases I've had and thoughts on Outerbounds' current or planned answers to them
đź‘€ 1
message has been deleted
^^^ Here is a ZenML pipeline which uses a functional interface. Notice that 1. it uses 60 lines to define the steps where as the metaflow example will use 120. 2. it is very clear which step outputs are consumed by which later downstream steps, without needed to back track and parse the order of the methods in a class 3. it is very easy to understand the logical ordering of the steps
The equivalent metaflow flow. (you may need to squint, I went back and forth with ChatGPT a few times on this one)
message has been deleted
Why do you need a functional interface to make your flows short? Why can't you just extract all the insides of your step functions into a
helpers
module?
We do, but even with that, 1. you have to repeat a bunch of boilerplate for each step a.
@resources(...)
b.
@step
c.
def <some step name>
d.
"""some docstring
e.
from helpers import thing
f.
self.something = thing(self.other)
g.
self.next(...)
h. ^^^ it's quite a lot 2. It still isn't clear which order the steps run in just looking at the code 3. And it isn't clear the dependency relationship between the steps (which inputs/outputs do steps produce and consume)
d
A few comments: • spin: it’s soon. It will be like importing and calling a function but yes, the “context” (artifacts from the previous steps) will need to be mocked or you will be able to use an actual previous step if you want. • what do you mean by the “shape”? What would you like to see that is not in show (or that is too much in show)? • I am not sure we can completely make input/output because the whole notion of “context” (previous artifacts) is hard to capture that way. • conditional steps are merged so should be out soon. • you can get all the resources and other decorators through configs and baseflow/custom decorators today. We do plan on extending that (at some point) to allow the programatic construction of the flow (ie: right now you can add parameters, decorators, etc but soon you will be able to define steps)
👍 1
v
@lively-lunch-9285 (metacomment) thanks for sharing use cases and examples - super useful! 🤗
❤️ 1
plus+1 1
d
(Ishould have started with that)
ninjajump 1
l
Thanks 🙂
What is "shape"
This, but for each step:
flow.py show
shows you a list of steps, but not necessarily which order they run in. And also not the input/output relationships, whereas that's more clear in the functional example
Granted, a UI-based solution is definitely appreciated (in addition). It's just annoying to not be able to send someone the code and have them be able to quickly understand the big picture. Here's how ZenML does it, note that the green boxes are steps and the purple boxes are step inputs/outputs
f
Just noting that spelling out inputs and outputs can also come with performance improvements-- we take the hash of inputs + code and use that to memoize steps in the flow to avoid repeating work across runs.
👍 1
đź’ˇ 1