Amit Arie
08/03/2022, 6:02 PMStepExecutionContext
or HookContext
?Matthew Karas
08/03/2022, 6:12 PMAmit Arie
08/03/2022, 6:12 PMowen
08/04/2022, 9:08 PMStepExecutionContext
, you can query the Dagster database for statistics about your step like this:
step_stats = context.instance.get_run_step_stats(
run_id=context.run_id,
step_keys=[<step key you care about>],
)[0]
duration = step_stats.end_time - step_stats.start_time
if you have a HookContext
, our API doesn't currently provide public access to the underlying step context (not sure exactly why that is), but if you need to you can access the instance using context._step_execution_context.instance
. Just be aware that, because this is a private property, its name might change in the future (although that's unlikely)Amit Arie
08/05/2022, 11:57 AMowen
08/05/2022, 9:52 PM