Complete the code to define a task using the TaskFlow API decorator.
@dag def my_dag(): @[1] def extract(): return 'data'
The @task decorator defines a task in the TaskFlow API.
Complete the code to pass data between tasks using the TaskFlow API.
@dag def my_dag(): @task def extract(): return 'data' @task def process(data): print(data) processed = process([1])
extract instead of calling it.Calling extract() runs the task and passes its output to process.
Fix the error in the task definition to correctly return a value for XCom.
@dag def my_dag(): @task def extract(): [1] 'data'
Tasks must return values to push them to XCom for downstream tasks.
Fill both blanks to create a DAG that runs the tasks in order using the TaskFlow API.
@dag def my_dag(): @task def extract(): return 'data' @task def process(data): print(data) data = extract() [1] = process([2])
extract() again instead of the variable.Assign the output of process to result and pass data as input.
Fill all three blanks to define a DAG with three tasks where data flows from extract to transform to load.
@dag def my_dag(): @task def extract(): return 'raw data' @task def transform(data): return data.upper() @task def load(data): print(f'Loading: {data}') raw = [1]() transformed = [2]([3]) load(transformed)
Call extract() to get raw data, pass it to transform, then load the transformed data.
