-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- cli command to copy cards from other tasks - Exposing the interface in `current.card` so that cards can be copied over during runtime. This also allows users the flexibility to select which cards to copy during runtime. - useful for the cases when users need to showcase the model card in downstream steps without having to re-render the card everytime. - Example flow: ```python from metaflow import FlowSpec, step, card, current class CardCopyTestFlow(FlowSpec): """ A flow that demonstrates the card copy functionality. """ @card(type="blank") @step def start(self): """ Create a card in the start step. """ from metaflow.cards import Markdown current.card.append(Markdown("# Original Card")) current.card.append(Markdown("This card was created in the start step.")) self.pathspec = current.pathspec self.next(self.copy_card) @card(type="blank") @step def copy_card(self): """ Copy the card from the start step. """ from metaflow.cards import Markdown # First, create a new card for this step current.card.append(Markdown("# Destination Card")) current.card.append(Markdown("This card was created in the copy_card step.")) # Now, copy the card from the start step # Get the pathspec for the start step # Copy the card from the start step success = current.card.copy(self.pathspec) if success: current.card.append(Markdown("## Card Copy Success")) current.card.append(Markdown(f"Successfully copied card from {self.pathspec}")) else: current.card.append(Markdown("## Card Copy Failed")) current.card.append(Markdown(f"Failed to copy card from {self.pathspec}")) self.next(self.end) @step def end(self): """ End the flow. """ print("Flow completed successfully!") if __name__ == "__main__": CardCopyTestFlow() ```
- Loading branch information
Showing
2 changed files
with
196 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters