ddp-ro opened a new issue, #56364:
URL: https://github.com/apache/airflow/issues/56364
### Apache Airflow version
3.1.0
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
When using `Connection.get('connection_name')` in a `task.virtualenv`
operator, the following exception is raised:
```
cannot import name 'SUPERVISOR_COMMS' from
'airflow.sdk.execution_time.task_runner'
(/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py)
```
### What you think should happen instead?
`Connection.get('connection_name')` should return a `Connection` instance if
one exists.
### How to reproduce
- Create a connection to test with
```python
from airflow.sdk import DAG, task
from datetime import datetime, timedelta
default_args = {
"depends_on_past": False,
"email_on_failure": True,
"email_on_retry": False,
"retries": 2,
"retry_delay": timedelta(seconds=1),
}
with DAG(
"Get_Conn",
start_date=datetime(2025, 1, 1),
catchup=False,
schedule=None,
default_args=default_args,
) as dag:
@task.virtualenv()
def get_conn():
from airflow.sdk import Connection
print(Connection.get("test_conn"))
get_conn()
```
### Operating System
Debian GNU/Linux 12 (bookworm)
### Versions of Apache Airflow Providers
apache-airflow-providers-amazon==9.14.0
apache-airflow-providers-celery==3.12.3
apache-airflow-providers-cncf-kubernetes==10.0.0
apache-airflow-providers-common-compat==1.7.4
apache-airflow-providers-common-io==1.6.3
apache-airflow-providers-common-messaging==2.0.0
apache-airflow-providers-common-sql==1.28.1
apache-airflow-providers-docker==4.4.3
apache-airflow-providers-elasticsearch==6.3.3
apache-airflow-providers-fab==2.4.3
apache-airflow-providers-ftp==3.13.2
apache-airflow-providers-git==0.0.8
apache-airflow-providers-google==18.0.0
apache-airflow-providers-grpc==3.8.2
apache-airflow-providers-hashicorp==4.3.2
apache-airflow-providers-http==5.3.4
apache-airflow-providers-microsoft-azure==12.7.1
apache-airflow-providers-mysql==6.3.4
apache-airflow-providers-odbc==4.10.2
apache-airflow-providers-openlineage==2.7.1
apache-airflow-providers-postgres==5.11.2
apache-airflow-providers-redis==4.3.1
apache-airflow-providers-sendgrid==4.1.3
apache-airflow-providers-sftp==5.4.0
apache-airflow-providers-slack==9.3.0
apache-airflow-providers-smtp==2.2.1
apache-airflow-providers-snowflake==6.5.4
apache-airflow-providers-ssh==4.1.3
apache-airflow-providers-standard==1.8.0
### Deployment
Docker-Compose
### Deployment details
dockerfile deployed with docker compose:
```docker
FROM apache/airflow:3.1.0
COPY airflow_requirements.txt /opt/airflow/requirements.txt
USER root
RUN apt-get update
RUN apt-get -y install git
USER airflow
RUN ["/home/airflow/.local/bin/pip", "install", "--no-cache-dir", "-r",
"/opt/airflow/requirements.txt"]
```
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]