potiuk commented on a change in pull request #17339:
URL: https://github.com/apache/airflow/pull/17339#discussion_r680175088



##########
File path: airflow/sensors/external_task.py
##########
@@ -111,12 +117,23 @@ def __init__(
                 "`{}` and failed states `{}`".format(self.allowed_states, 
self.failed_states)
             )
 
-        if external_task_id:
+        if external_task_id is not None and external_task_ids is not None:
+            raise ValueError(
+                'Only one of `external_task_id` or `external_task_ids` may '
+                'be provided to ExternalTaskSensor; not both.'
+            )
+
+        if external_task_id is not None:
+            external_task_ids = [external_task_id]
+
+        if external_task_ids:
             if not total_states <= set(State.task_states):
                 raise ValueError(
                     f'Valid values for `allowed_states` and `failed_states` '
-                    f'when `external_task_id` is not `None`: 
{State.task_states}'
+                    f'when `external_task_id` or `external_task_ids` is not 
`None`: {State.task_states}'
                 )
+            if len(external_task_ids) > len(set(external_task_ids)):
+                raise ValueError('Duplicate task_ids passed in 
external_task_ids parameter')

Review comment:
       Nice check!




-- 
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]


Reply via email to