Skip to content

Metastore not available from external_python task #51062

Description

@fromm1990

Hi, i have decided to create a new issue, however, I think it relates to #48554.
I get the following error in v3.0.1 when trying to retrieve variables from the metastore within an external python environment ImportError: cannot import name 'SUPERVISOR_COMMS' from 'airflow.sdk.execution_time.task_runner'.

Retrieving the same variable within the same DAG but using an ordinary task, works just fine. I'm therefore let to believe that this is caused by accessing the metastore from an external environment. The variable shows when executing the airflow variables list command from an python environment activated terminal. In my opinion, the latter suggests, that the virtual environment should be properly set up.

Retrieving variables from the metastor within external python environments worked fine for me in v2.10.5 (however using from airflow.models import Variable instead of from airflow.sdk import Variable)

I cannot retrieve connections stored in the metastore from an external environment either. However, I do not know if this is caused by the same root problem.

My original post can be found beneath .

I seem to get this error in 3.0.1 as well when using Variable.get("my_variable") inside an external_python task. The variable is perfectly able to be retrieved from an ordinary task. The variable is also listed when executing the airflow variables list command from an python environment activated terminal. The latter suggests, that the virtual environment should be properly set up, in my opinion. This setup worked fine in airflow 2.10.5 (however using from airflow.models import Variable instead of from airflow.sdk import Variable)

I don't know if the cause of this issue is the same, but sounds similar to me.

Originally posted by @fromm1990 in #48554

Metadata

Metadata

Assignees

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions