https://dagster.io/ logo
#ask-ai
Title
# ask-ai
j

Jérôme MONTIGNY

02/20/2024, 9:52 AM
How to check the name of the step of the job that has been run in a hook ?
s

Scout

02/20/2024, 9:52 AM
To check the name of the step of the job that has been run in a hook, you can access the
step_key
property from the
HookContext
. The
step_key
is the key for the step where the hook is being triggered. Here's how you can access it within a hook:
Copy code
python @hook def my_hook(context):     step_key = context.step_key     # You can now use the step_key for your logic
This
step_key
will give you the identifier for the specific step within the job that the hook is responding to.