nuclearpinguin commented on a change in pull request #6898: [AIRFLOW-6432] fix
EmrAddStepsOperator broken ref & faulty test & add test case for missing cluster
URL: https://github.com/apache/airflow/pull/6898#discussion_r361808039
##########
File path: airflow/contrib/operators/emr_add_steps_operator.py
##########
@@ -68,12 +68,16 @@ def __init__(
self.steps = steps
def execute(self, context):
- emr = EmrHook(aws_conn_id=self.aws_conn_id).get_conn()
+ emr_hook = EmrHook(aws_conn_id=self.aws_conn_id)
+
+ emr = emr_hook.get_conn()
job_flow_id = self.job_flow_id
if not job_flow_id:
- job_flow_id = emr.get_cluster_id_by_name(self.job_flow_name,
self.cluster_states)
+ job_flow_id = emr_hook.get_cluster_id_by_name(self.job_flow_name,
self.cluster_states)
+ if not job_flow_id:
Review comment:
There is duplicated check, what about:
```python
job_flow_id = job_flow_id or
emr_hook.get_cluster_id_by_name(self.job_flow_name, self.cluster_states)
if not job_flow_id:
raise...
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services