Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove EMR Conn from example #525

Merged
merged 3 commits into from
Aug 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
JOB_FLOW_ROLE = os.getenv("EMR_JOB_FLOW_ROLE", "EMR_EC2_DefaultRole")
SERVICE_ROLE = os.getenv("EMR_SERVICE_ROLE", "EMR_DefaultRole")
AWS_CONN_ID = os.getenv("ASTRO_AWS_CONN_ID", "aws_default")
EMR_CONN_ID = os.getenv("ASTRO_EMR_CONN_ID", "emr_default")
EXECUTION_TIMEOUT = int(os.getenv("EXECUTION_TIMEOUT", 6))

SPARK_STEPS = [
Expand Down Expand Up @@ -68,11 +67,12 @@
tags=["example", "async", "emr"],
catchup=False,
) as dag:
# For apache-airflow-providers-amazon < 4.1.0 you will also have to pass emr_conn_id param
# [START howto_operator_emr_create_job_flow_steps_tasks]
cluster_creator = EmrCreateJobFlowOperator(
task_id="create_job_flow",
job_flow_overrides=JOB_FLOW_OVERRIDES,
emr_conn_id=EMR_CONN_ID,
aws_conn_id=AWS_CONN_ID,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this fail for apache-airflow-providers-amazon < 4.1.0 ? We should make it fail safe for previous versions of the provider then. Something similar to this, with a try-except block catching the exception: #471 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, it would fail for apache-airflow-providers-amazon < 4.1.0. Does it make sense to safe fail here since this is an integration test?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend to add try-except block to fail safe for previous versions as well as @pankajkoti suggested even though it is in integration

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phanikumv @bharanidharan14 what is your opinion on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pankajkoti I would recommend to add try-except block. I have mentioned it already

Copy link
Contributor

@rajaths010494 rajaths010494 Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we can use try-catch for an argument being passed to the operator.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can add a comment in the example DAG that based on the versions of the provider what arguments are expected

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pankajastro adding comments in the example DAG is reasonable to me, so it helps user to know what arguements needs to be passed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pankajastro Is this review comment is addressed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I have added a comment.

)
# [END howto_operator_emr_create_job_flow_steps_tasks]

Expand Down