python-3.x 有没有办法从Dagster failure_hook和success_hook中获取回溯堆栈?

xfyts7mz  于 4个月前  发布在  Python
关注(0)|答案(2)|浏览(68)
from dagster import HookContext, failure_hook, success_hook

@success_hook(required_resource_keys={"slack"})  
def slack_message_on_success(context: HookContext):  
    message = f"Solid {context.solid.name} finished successfully"
    context.resources.slack.chat.post_message(channel="#foo", text=message)

@failure_hook(required_resource_keys={"slack"})
def slack_message_on_failure(context: HookContext):
    message = f"Solid {context.solid.name} failed"
    context.resources.slack.chat.post_message(channel="#foo", text=message)

字符串
是否有一个字段可以从“上下文”中提取回溯堆栈,以定位触发的异常并发送电子邮件或松弛消息?

mznpcxlj

mznpcxlj1#

不幸的是,Dagster目前不支持这一点,这里是GH issue来跟踪此请求。

izj3ouym

izj3ouym2#

只是更新一下,现在已经支持了。

context.op_exception.with_traceback(context.op_exception.__traceback__)

字符串
比如说

slack.chat_postMessage(channel=dagster_flow, context.op_exception.with_traceback(context.op_exception.__traceback__))

相关问题