ashb commented on a change in pull request #6655: [AIRFLOW-6056] Allow 
EmrAddStepsOperator to accept job_flow_name as alternative to job_flow_id

 File path: airflow/contrib/operators/
 @@ -28,33 +28,57 @@ class EmrAddStepsOperator(BaseOperator):
     :param job_flow_id: id of the JobFlow to add steps to. (templated)
     :type job_flow_id: str
+    :param job_flow_name: name of the JobFlow to add steps to. Use as an 
alternative to passing
+        job_flow_id. will search for id of JobFlow with matching name in one 
of the states in
+        param cluster_states. Exactly one cluster like this should exist or 
will fail. (templated)
+    :type job_flow_name: str
+    :param cluster_states: Acceptable cluster states when searching for 
JobFlow id by param job_flow_name. (templated)
+    :type cluster_states: list
     :param aws_conn_id: aws connection to uses
     :type aws_conn_id: str
     :param steps: boto3 style steps to be added to the jobflow. (templated)
     :type steps: list
+    :param do_xcom_push: if True, job_flow_id is pushed to XCom with key 
+    :type do_xcom_push: bool
-    template_fields = ['job_flow_id', 'steps']
+    template_fields = ['job_flow_id', 'job_flow_name', 'cluster_states', 
     template_ext = ()
     ui_color = '#f9c915'
     def __init__(
-            self,
-            job_flow_id,
-            aws_conn_id='aws_default',
-            steps=None,
-            *args, **kwargs):
+        self,
+        job_flow_id=None,
+        job_flow_name=None,
+        cluster_states=None,
+        aws_conn_id='s3_default',
+        steps=None,
+        *args, **kwargs):
+        if kwargs.get('xcom_push') is not None:
+            raise AirflowException("'xcom_push' was deprecated, use 
'do_xcom_push' instead")
         super().__init__(*args, **kwargs)
+        if not job_flow_id and not job_flow_name:
+            raise AirflowException('Either job_flow_id or job_flow_name must 
be specified.')
 Review comment:
   We should also check that both are not specified, right?

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:

With regards,
Apache Git Services

Reply via email to