nutritious-magazine-38839
04/04/2025, 10:28 PMrender
method is only triggered for successful steps, if I understand correctly -- is there any way to render a card even after a step failed?ancient-application-36103
04/05/2025, 2:55 AMnutritious-magazine-38839
04/06/2025, 7:49 PMcard(type='html')
@step
def train(self):
self.html = "foobar"
error
this results in a failed step, without the HTML card rendered .. while it could be useful to render it.
I understand the above could be solved by using a blank
card type and calling append
and `refresh`on it before the error .. but I wonder if forcing the rendering of card without realtime updates is achievable somehownutritious-magazine-38839
04/07/2025, 9:23 PMrender
is already running in the task_finished
method and not in the task_post_step
, and it's only filtered out at https://github.com/Netflix/metaflow/blob/master/metaflow/plugins/cards/card_decorator.py#L268 by checking the status of the step .. so I wonder if it would be possible to make that check optional e.g. via card
attributes/configs and optionally render the card on failed steps as well š¤ any thoughts?hallowed-glass-14538
04/07/2025, 10:35 PMrender_runtime
, reload_token
, refresh
a. These is an example card here . The usage of this card is present here
This way you can render the card before runtime and during runtime so that covers the failure case too. Currently there is no explicit callback on failure.nutritious-magazine-38839
04/12/2025, 10:09 PMstep_init
, but I think I got this working.
Sharing here if others might find it useful in the future when searching for something like this: https://github.com/SpareCores/resource-tracker/commit/7c7b2312ae21d45c925992d96d38308d6a23a1e1, but in short:
⢠storing the artifacts needed for the card in the task_exception
, just like I did in the task_post_step
method in the past
⢠implemented the task_finished
method mimicking the `CardDecorator`'s task_finished
method without checking for the step's status, so basically rendering the card
And this is it .. it works, but there a few minor caveats, like the standard Metaflow client cannot find the stored artifacts (e.g. via Flow(...).latest_run.data
) or cards (e.g. via get_cards
), but the Metaflow CLI can find on disk, so had to use that in the related unit tests to check if the card was indeed created -- I hope I'm not touching anything highly breakable (e.g. with future Metaflow versions) with this approach.