zip を使った入力のペアリング
あなたのチームには、ファイルを特定のクラウドストレージの場所にアップロードするパイプラインがあります。同僚が zip() と expand_kwargs() を使って、各ファイルをアップロード先とペアにしています。
@task
def get_files():
return ["users.csv", "orders.csv", "products.csv"]
@task
def get_destinations():
return ["s3://bronze/users/", "s3://bronze/orders/", "s3://bronze/products/"]
@task
def upload(file_to_upload):
# Simulate uploading a file to cloud storage
print(f"Uploading {file_to_upload[0]} to {file_to_upload[1]}")
files = get_files()
destinations = get_destinations()
upload.expand(file_to_upload=files.zip(destinations))
Airflow は upload のインスタンスをいくつ作成するでしょうか?
この演習はコースの一部です
