Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Airflow 从另一个任务的输出动态创建任务_Airflow_Airflow Scheduler - Fatal编程技术网

Airflow 从另一个任务的输出动态创建任务

Airflow 从另一个任务的输出动态创建任务,airflow,airflow-scheduler,Airflow,Airflow Scheduler,目前,我可以通过加载配置文件并循环使用以下值在airflow中动态创建任务: s3 = boto3.resource("s3") s3Client = boto3.client("s3") result = s3Client.get_object(Bucket='mybucket', Key='file1/inputs.json') models = json.loads(result["Body"].read().decode())

目前,我可以通过加载配置文件并循环使用以下值在airflow中动态创建任务:

s3 = boto3.resource("s3")
s3Client = boto3.client("s3")
result = s3Client.get_object(Bucket='mybucket', Key='file1/inputs.json')
models = json.loads(result["Body"].read().decode())

for item in models:
    run_model = PythonOperator(
        task_id=item["col1"] +"_run_model",
        python_callable=batch_runner,
        dag=dag,
        op_kwargs={
            "job_name": "run_model",
            "parameters": {
                "script_name": "model.py",
                "script_path": "model.py",
            },
            "path_prefix": Variable.get("path_prefix"),
            "command_list": [
                "script.sh",
                "Ref::script_path",
                "Ref::script_name",
            ],
        },
        provide_context=True,
    )

    run_model
我的输入会随着时间的推移而改变,我想先添加一个任务来生成json文件,然后在dag中读取该文件的输入来生成我的run_模型任务。是否可以从第一个任务中动态获取输入文件,并传递该文件以创建所有其他任务?这就是XCOM可以使用的地方吗