uranusjr commented on code in PR #32990:
URL: https://github.com/apache/airflow/pull/32990#discussion_r1284003777
##########
airflow/models/taskinstance.py:
##########
@@ -166,6 +166,16 @@ class TaskReturnCode(Enum):
"""When task exits with deferral to trigger."""
+def get_current_context() -> Context:
+ """Retrieve the execution context dictionary without altering user
method's signature."""
+ if not _CURRENT_CONTEXT:
+ raise AirflowException(
+ "Current context was requested but no context was found! "
+ "Are you running within an airflow task?"
+ )
+ return _CURRENT_CONTEXT[-1]
Review Comment:
Why do we need to move this? The import is done locally anyway and from what
I can tell it can live where it has been.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]