示例#1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        build_prolog_task = PythonOperator(
            task_id="Build_prolog_task",
            provide_context=True,
            python_callable=MapsGenerationDAG.build_prolog,
            dag=self,
        )

        build_epilog_task = PythonOperator(
            task_id="Build_epilog_task",
            provide_context=True,
            python_callable=MapsGenerationDAG.build_epilog,
            dag=self,
        )

        publish_maps_task = PythonOperator(
            task_id="Publish_maps_task",
            provide_context=True,
            python_callable=MapsGenerationDAG.publish_maps,
            dag=self,
        )

        rm_build_task = make_rm_build_task(self)

        build_epilog_task >> publish_maps_task >> rm_build_task
        for country in get_all_countries_list(PathProvider.borders_path()):
            build_prolog_task >> self.make_mwm_operator(
                country) >> build_epilog_task
示例#2
0
        ),
    )
    env.finish()


def publish_planet(**kwargs):
    build_name = kwargs["ti"].xcom_pull(key="build_name")
    env = Env(build_name=build_name)
    storage.wd_publish(env.paths.planet_o5m, PLANET_STORAGE_PATH)
    storage.wd_publish(md5_ext(env.paths.planet_o5m),
                       md5_ext(PLANET_STORAGE_PATH))


UPDATE_PLANET_TASK = PythonOperator(
    task_id="Update_planet_task",
    provide_context=True,
    python_callable=update_planet,
    dag=DAG,
)

PUBLISH_PLANET_TASK = PythonOperator(
    task_id="Publish_planet_task",
    provide_context=True,
    python_callable=publish_planet,
    dag=DAG,
)

RM_BUILD_TASK = make_rm_build_task(DAG)

UPDATE_PLANET_TASK >> PUBLISH_PLANET_TASK >> RM_BUILD_TASK