fjmacagno commented on issue #40103:
URL: https://github.com/apache/airflow/issues/40103#issuecomment-2154975696
```
from datetime import datetime
from airflow import DAG
from airflow.providers.amazon.aws.operators.emr import (
EmrServerlessCreateApplicationOperator,
EmrServerlessDeleteApplicationOperator, EmrServerlessStartJobOperator,
)
from foursquare_plugin.policies import FsqDagTag
from fsq.airflow.helpers.emr.serverless.application_config_builder import
ServerlessApplicationConfigBuilder
from fsq.airflow.helpers.emr.serverless.job_driver_builder import
ServerlessJobDriverBuilder
from fsq.airflow.team.aws_account_configs import NotebookInternalProtocol
from fsq.airflow.team.team import DEVELOPER_EXPERIENCE_TEAM
with DAG(
dag_id="spark-pipeline-example",
schedule_interval=None,
start_date=datetime(2021, 1, 1),
default_args={
"owner": DEVELOPER_EXPERIENCE_TEAM.name(),
},
tags=[FsqDagTag.TEST_AT_WILL.name],
) as dag:
create_app = EmrServerlessCreateApplicationOperator(
task_id="create-spark-app",
job_type="SPARK",
release_label="emr-6.10.0",
config=ServerlessApplicationConfigBuilder(NotebookInternalProtocol())
.with_name("spark-pipeline-example")
.build(),
aws_conn_id=NotebookInternalProtocol().aws_conn_id(),
)
application_id: str = str(create_app.output)
jar_submit_job = EmrServerlessStartJobOperator(
task_id="join-chains-categories",
config={"name": "join-chains-categories-test"},
application_id=application_id,
execution_role_arn=NotebookInternalProtocol().emr_serverless_role_arn(),
job_driver=(
ServerlessJobDriverBuilder()
.with_entry_point("s3://4sq-dev/artifacts/fsq-graph-spark-examples_deploy.jar")
.with_class("com.foursquare.spark.examples.S3ReadWriteExample")
.build()
),
wait_for_completion=True,
deferrable=True,
aws_conn_id=NotebookInternalProtocol().aws_conn_id(),
configuration_overrides=create_app.output, <----- important line
)
delete_app = EmrServerlessDeleteApplicationOperator(
task_id="delete_app",
application_id=application_id,
trigger_rule="all_done",
aws_conn_id=NotebookInternalProtocol().aws_conn_id(),
)
(create_app >> jar_submit_job >> delete_app)
```
Works fine until i add the line labeled "important line".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]