-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
[AIRFLOW-867] Enable and fix lots of untested unit tests #2078
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1108,7 +1108,6 @@ def are_dependencies_met( | |
:param verbose: whether or not to print details on failed dependencies | ||
:type verbose: boolean | ||
""" | ||
dep_context = dep_context or DepContext() | ||
failed = False | ||
for dep_status in self.get_failed_dep_statuses( | ||
dep_context=dep_context, | ||
|
@@ -1131,7 +1130,6 @@ def get_failed_dep_statuses( | |
self, | ||
dep_context=None, | ||
session=None): | ||
dep_context = dep_context or DepContext() | ||
for dep in dep_context.deps | self.task.deps: | ||
for dep_status in dep.get_dep_statuses( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above (why remove this line?) |
||
self, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ def _get_dep_statuses(self, ti, session, dep_context): | |
raise NotImplementedError | ||
|
||
@provide_session | ||
def get_dep_statuses(self, ti, session, dep_context): | ||
def get_dep_statuses(self, ti, session, dep_context=None): | ||
""" | ||
Wrapper around the private _get_dep_statuses method that contains some global | ||
checks for all dependencies. | ||
|
@@ -81,6 +81,10 @@ def get_dep_statuses(self, ti, session, dep_context): | |
:param dep_context: the context for which this dependency should be evaluated for | ||
:type dep_context: DepContext | ||
""" | ||
from airflow.ti_deps.dep_context import DepContext | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should avoid imports at local scope. I think the previous implementation was OK but it seems you have some concerns? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The motivation is probably clearer in the original commit before the squash. While it's possible to make |
||
if dep_context is None: | ||
dep_context = DepContext() | ||
|
||
if self.IGNOREABLE and dep_context.ignore_all_deps: | ||
yield self._passing_status( | ||
reason="Context specified all dependencies should be ignored.") | ||
|
@@ -95,7 +99,7 @@ def get_dep_statuses(self, ti, session, dep_context): | |
yield dep_status | ||
|
||
@provide_session | ||
def is_met(self, ti, session, dep_context): | ||
def is_met(self, ti, session, dep_context=None): | ||
""" | ||
Returns whether or not this dependency is met for a given task instance. A | ||
dependency is considered met if all of the dependency statuses it reports are | ||
|
@@ -113,7 +117,7 @@ def is_met(self, ti, session, dep_context): | |
self.get_dep_statuses(ti, session, dep_context)) | ||
|
||
@provide_session | ||
def get_failure_reasons(self, ti, session, dep_context): | ||
def get_failure_reasons(self, ti, session, dep_context=None): | ||
""" | ||
Returns an iterable of strings that explain why this dependency wasn't met. | ||
|
||
|
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.
Why remove this line?