Access Op inputs in failure hook #6275
Replies: 2 comments
-
I had the same question. I ended up using Is there a better way to do it given that hook context doesn’t have access to the inputs of the op. |
Beta Was this translation helpful? Give feedback.
-
This is definitely a tricky problem, and it's correct that it's not currently possible to directly access the op inputs. I wrote up an issue to track this here: #9256 Right now, the best solution for passing runtime information to the HookContext is indeed a hacky thing involving op_exception (at least for failure hooks, where there will be no outputs). That could look something like:
This way, the op_exception will be an instance of MyCustomException, which will have that extra info |
Beta Was this translation helpful? Give feedback.
-
Hello all!
I am new to Dagster, hope this isn't too obvious. I have a job where the first Op produces an ID, associated with an entity in another service. The rest of the Ops take this ID as an input and perform some actions on the entity. I would like this entity to be deleted in case of failure, so I tried to use a
failure_hook
. However, I can't seem to find how to get myid
inside the failure hook. Consider the following example:Any ideas how the Id (or any other input of the failing Op) can be accessed in the hook, through HookContext?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions