-
Notifications
You must be signed in to change notification settings - Fork 0
Dag template #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Dag template #257
Conversation
| base_url = "https://github.com/profcomff/dwh-pipelines/blob/main/" | ||
|
|
||
|
|
||
| class DAG_TEMPLATE(DAG): |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
для полиморфизма следует соблюдать единство интерфейса конструктора класса-наследника и класса-родителя
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 базового класса)
Написал шаблончик. Попробовал вызывать алерт через лямбда функцию (мне кажется так эстетичнее). Также этот ПР должен исправлять ошибку импорта integrity_check