def execute(self, context): hook = PostgresHook(postgres_conn_id=self.conn_id) connection_string = hook.get_uri() log_pg_table( self.table_name, connection_string, with_histograms=True, )
task=context.get('task_instance').task_id, dag=context.get('task_instance').dag_id, ti=context.get('task_instance'), exec_date=context.get('execution_date'), log_url=context.get('task_instance').log_url, ) failed_alert = SlackWebhookOperator(task_id='slack_alert', http_conn_id='slack', webhook_token=slack_webhook_token, message=slack_msg, username='******') return failed_alert.execute(context=context) here_postgres = PostgresHook("here_bot") rds_con = here_postgres.get_uri() default_args = { 'owner': 'rdumas', 'depends_on_past': False, 'start_date': datetime(2020, 1, 5), 'email': ['*****@*****.**'], 'email_on_failure': False, 'email_on_success': False, 'retries': 0, 'retry_delay': timedelta(minutes=5), 'on_failure_callback': task_fail_slack_alert, 'env': { 'here_bot': rds_con, 'LC_ALL': 'C.UTF-8', #Necessary for Click 'LANG': 'C.UTF-8'