Nataneljpwd commented on code in PR #53651:
URL: https://github.com/apache/airflow/pull/53651#discussion_r2223743616


##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -200,6 +200,17 @@ def _get_variable(key: str, deserialize_json: bool) -> Any:
     from airflow.sdk.execution_time.comms import ErrorResponse, GetVariable
     from airflow.sdk.execution_time.task_runner import SUPERVISOR_COMMS
 
+    if SUPERVISOR_COMMS is None:
+        # if this happens, that means that we are not in task_runner scope and 
most likely are in the
+        # dag parser scope, which means that SUPERVISOR_COMMS won't work as it 
connects to a socket on the
+        # task_runner, and hence we throw the notfound error, during runtime, 
the variable might work
+        raise AirflowRuntimeError(
+            ErrorResponse(
+                error=ErrorType.VARIABLE_NOT_FOUND,
+                detail={"message": "Variable not found in any airflow 
backend"},
+            )
+        )

Review Comment:
   Oh ok, I guess I overlooked that, I will fix it



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to