Skip to content
Advertisement

Create success hook with telegram-bot alert

I’m new in Dagster and try to create success hook that will send alerts through a telegram bot. Need help, please

Resource:

JavaScript

Hook:

JavaScript

Job:

JavaScript

Error:

dagster._check.CheckError: Member of set mismatches type. Expected <class ‘dagster._core.definitions.hook_definition.HookDefinition’>. Got <function success_hook at 0x00000284AC2BB250> of type <class ‘function’>.

UPDATE:

JavaScript

Job:

JavaScript

Hook:

JavaScript

New Error: TypeError: telegram_resource..TelegramConnection.send_message() takes 1 positional argument but 2 were given

Stack Trace: File “C:UsersAlBelyaevAppDataLocalProgramsPythonPython310libsite-packagesdagster_coreerrors.py”, line 188, in user_code_error_boundary yield , File “C:UsersAlBelyaevAppDataLocalProgramsPythonPython310libsite-packagesdagster_coreexecutionplanexecute_plan.py”, line 162, in _trigger_hook hook_execution_result = hook_def.hook_fn(hook_context, step_event_list) , File “C:UsersAlBelyaevAppDataLocalProgramsPythonPython310libsite-packagesdagster_coredefinitionsdecoratorshook_decorator.py”, line 198, in _success_hook fn(context) , File “C:DEdagstermy-dagster-projectmy_dagster_projecthookstext_for_pictures.py”, line 50, in _hook context.resources.telegram.send_message(text) # type: ignore

Advertisement

Answer

I think you need to the result of calling your telegram_on_success function to your @job definition, something like this:

JavaScript

Right now by passing success_hook to the hooks= argument, you’re just passing the @success_hook wrapper and not your actual success hook definition.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement