@task and chain() don't play well together
See original GitHub issueApache Airflow version
main (development)
What happened
I’ve been told that the current community preference is to use an @task decorated method instead of the Python Operator when possible, but the chain() method does not support that yet. ci_install_and_test_provider_packages.sh will fail with the following message:
File "/usr/local/lib/python3.7/site-packages/airflow/models/baseoperator.py", line 1578, in chain
up_type=type(up_task), down_type=type(down_task)
TypeError: Chain not supported between instances of <class 'airflow.models.xcom_arg.XComArg'>
and <class 'airflow.models.xcom_arg.XComArg'>
What you think should happen instead
Might be as simple as adding the Typing to the chain() signature?
How to reproduce
see this example DAG
In case that isn’t persistent, this should do it as well:
from datetime import datetime
from airflow import DAG
from airflow.decorators import task
from airflow.models.baseoperator import chain
@task
def echo1():
print('hello')
@task
def echo2():
print('world')
with DAG(
dag_id='example_dag',
schedule_interval=None,
start_date=datetime(2021, 1, 1),
tags=['example'],
catchup=False,
) as dag:
chain(echo1(), echo2())
Operating System
linux
Versions of Apache Airflow Providers
No response
Deployment
Docker-Compose
Deployment details
I am running it in an updated Breeze environment and it passes all test there; this does not fail until the CI tests on github run /opt/airflow/scripts/in_container/run_install_and_test_provider_packages.sh
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
:: Suggestions / Ideas
my friend from china tried to do the "invite to play" task, but it doesn't work at all. so i gave him the...
Read more >China to U.S.: Don't play with fire over Taiwan | ANC - YouTube
Rundown: U.S. President Joe Biden sends and unofficial delegation to Taiwan to signal his personal commitment to the Chinese -claimed island ...
Read more >Understanding Chinese Consumers: Growth Engine of the ...
China's economy is unique, and is set to retain its pre-eminent role as the engine of global consumption growth post-pandemic. Companies will require...
Read more >Understanding the role reward types play in linking public ...
Understanding the role reward types play in linking public service motivation to task satisfaction: evidence from an experiment in China.
Read more >How Do Video Games Affect Brain Development in ...
"Playing video games floods the pleasure center of the brain with dopamine," says ... those tasks don't always translate into better thinking in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Assigned you 😃 in the meantime
Alright, after a chat with Jarek, this is a non-issue. The part I was missing was that chain() currently supports @task but did not in 2.1; providers require 2.1 compatibility so the CI testing failed on the backward compatibility checks.