Following up on this, we've adjusted this and replaced  `apply` with
`expand`.

Example:

@task
def directories():
    return ["~", "/etc"]

def create_ls_command(directory):
    return ["ls", directory]

# The following creates two tasks executing "ls ~" and "ls /etc".
DockerOperator.partial(
    task_id="run_command_in_container",
    ...,
).expand(
    command=directories().map(create_ls_command),
)

See the AIP-42 doc
<https://cwiki.apache.org/confluence/display/AIRFLOW/AIP-42+Dynamic+Task+Mapping>
for full details.

Reply via email to