dstandish commented on a change in pull request #20184:
URL: https://github.com/apache/airflow/pull/20184#discussion_r766252045
##########
File path: airflow/utils/helpers.py
##########
@@ -244,3 +244,18 @@ def build_airflow_url_with_query(query: Dict[str, Any]) ->
str:
view = conf.get('webserver', 'dag_default_view').lower()
url = url_for(f"Airflow.{view}")
return f"{url}?{parse.urlencode(query)}"
+
+
+def exactly_one(*args):
+ """
+ Returns True if exactly one of *args is "truthy", and False otherwise.
+ :param args:
+ :return:
+ """
+ has_one = False
+ for arg in args:
+ if arg and has_one:
+ return False
+ elif arg:
+ has_one = True
+ return has_one
Review comment:
> Because run_id can be an empty string, and we want to show a different
error for this situation.
OK in that case I updated XCom to use `is not None` to ensure no change in
behavior. And out of an abundance of caution, same for emr add steps. The
others did not need it.
> subtle, unintended behavioural change
Yeah I was mindful of the potential that it would be a meaningful change,
and did consider leaving the xcom calls with `is not None` to begin with. But
I wanted to put forward the less verbose approach with the expectation that
we'd confirm through the PR process whether it's kosher (as we've now done :)
).
So, there should now be no breaking changes in this PR, and what remains is
to decide on whether we should parameterize or not and if so how. It's also
something we could add later.
--
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]