#2251·metaflow

Sharing cards across multiple steps

Author: pacidicCreated Feb 7, 2025Updated Sep 6, 2026

I would like to create a "dashboard-style" card that summarizes information from multiple steps. For instance, when running parallel processes via a foreach step, I would like to update a common progress bar, rather than having one card for each step as in the example below. Is this currently possible?

from metaflow import FlowSpec, step, card, current, resources
from metaflow.cards import ProgressBar

import time

class ForeachFlow(FlowSpec):

    @step
    def start(self):
        self.values = [list(range(100)) for _ in range(3)]
        self.next(self.a, foreach='values')

    @resources(cpu=10)
    @card(type="blank")
    @step
    def a(self):

        pb = ProgressBar(max=len(self.input), label=current.step_name)
        current.card.append(pb)
        for n, val in enumerate(self.input, 1):
            pb.update(n)
            current.card.refresh()
            time.sleep(0.1)

        self.next(self.join)

    @step
    def join(self, inputs):
        self.merge_artifacts(inputs)
        self.next(self.end)

    @step
    def end(self):
        pass

if __name__ == '__main__':
    ForeachFlow()