Skip to content
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

Add a note against use of top level code in timetable #26649

Merged
merged 4 commits into from Sep 26, 2022

Conversation

ephraimbuddy
Copy link
Contributor

@ephraimbuddy ephraimbuddy commented Sep 24, 2022

Accessing Variables, Connections at top level of code is bad practice

closes: #26529

Comment on lines +168 to +172
return (
f"Timetable class {self.type_string!r} is not registered or "
"you have a top level database access that disrupted the session. "
"Please check the airflow best practices documentation."
)
Copy link
Member

Choose a reason for hiding this comment

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

I sort of feel that mentioning top level database access is a bit too specific. Maybe it’d be better to be slightly more vague here (there’s something wrong with eager variable evaluation in the class) instead. But I’m not strong on this—we can always reword this afterwards.

docs/apache-airflow/concepts/timetable.rst Outdated Show resolved Hide resolved
docs/apache-airflow/best-practices.rst Outdated Show resolved Hide resolved
docs/apache-airflow/best-practices.rst Outdated Show resolved Hide resolved
@ephraimbuddy ephraimbuddy merged commit 37c0cb6 into apache:main Sep 26, 2022
@ephraimbuddy ephraimbuddy deleted the doc-improvement branch September 26, 2022 22:01
@eladkal eladkal added this to the Airflow 2.4.2 milestone Sep 30, 2022
@ephraimbuddy ephraimbuddy added the type:doc-only Changelog: Doc Only label Oct 18, 2022
ephraimbuddy added a commit that referenced this pull request Oct 18, 2022
Accessing Variables, Connections at top level of code is bad practice

Add a section in best practices ref for timetable

(cherry picked from commit 37c0cb6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variable.get inside of a custom Timetable breaks the Scheduler
5 participants