Skip to content

Conversation

@RedstoneEnjoyer
Copy link
Contributor

Написал шаблончик. Попробовал вызывать алерт через лямбда функцию (мне кажется так эстетичнее). Также этот ПР должен исправлять ошибку импорта integrity_check

base_url = "https://github.com/profcomff/dwh-pipelines/blob/main/"


class DAG_TEMPLATE(DAG):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DAG это аббривеатура, поэтому она капсом написана
а ПравильноеНазваниеКапса обычно в CamelCase
то есть DAGTemplate
)

'execution_timeout': timedelta(minutes=30),
}

super().__init__(dag_id=dag_id, default_args=self.default_task_args, **default_dag_args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super(DAGTemplate, self).init(...)

'execution_timeout': timedelta(minutes=30),
}

super().__init__(dag_id=dag_id, default_args=self.default_task_args, **default_dag_args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

стоит наверное дальше прокидывать **kwargs раз уж они есть


class DAG_TEMPLATE(DAG):

def __init__(self, dag_id: str, path: str, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

для полиморфизма следует соблюдать единство интерфейса конструктора класса-наследника и класса-родителя

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почувствовал себя преподом по информатике щас

'catchup': False,
'doc_md': base_url + path,
'on_failure_callback': lambda ctx: alert_message(chat_id=get_chat_id(), context=ctx),
**kwargs,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а если я хочу переопределить в kwargs catchup например? будет SyntaxError?
либо:

  • default_dag_args.update(kwargs)
  • посмотреть какая в DAG.init сигнатура и согласно ей апдейтить этот словарь (я о том что скорее там нет kwargs но все аргументы хочется передавать в init базового класса)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants