Skip to content

venv_cache_path not a valid keyword argument when defining a task.virtualenv in taskflow api #36775

@themantalope

Description

@themantalope

Apache Airflow version

2.8.0

If "Other Airflow 2 version" selected, which one?

No response

What happened?

After declaring a task.virtualenv using a decorator and the TaskFlow API, the DAG has an import error:

Broken DAG: [/opt/airflow/dags/<dag>.py] Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/models/baseoperator.py", line 437, in apply_defaults
    result = func(self, **kwargs, default_args=default_args)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/models/baseoperator.py", line 794, in __init__
    raise AirflowException(
airflow.exceptions.AirflowException: Invalid arguments were passed to _PythonVirtualenvDecoratedOperator (task_id: <task name>). Invalid arguments were:
**kwargs: {'venv_cache_path': '/opt/airflow/dags/venvs/'}

What you think should happen instead?

As best I can tell per the documentation, venv_cache_path should be a valid keyword argument for the virtualenv task decorator.

How to reproduce

Please try to define a task.virtualenv with a venv_cache_path.

Operating System

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions