Taragolis commented on code in PR #29347:
URL: https://github.com/apache/airflow/pull/29347#discussion_r1111203656
##########
airflow/providers/ssh/hooks/ssh.py:
##########
@@ -173,6 +182,14 @@ def __init__(
if "conn_timeout" in extra_options and self.conn_timeout is
None:
self.conn_timeout = int(extra_options["conn_timeout"])
+ if self.cmd_timeout is None:
+ if "cmd_timeout" in extra_options:
+ self.cmd_timeout = (
+ int(extra_options["cmd_timeout"]) if
extra_options["cmd_timeout"] else None
+ )
+ else:
+ self.cmd_timeout = CMD_TIMEOUT
+
Review Comment:
Just for a record, we have a specific sentinel type and value, which use
when None as default value for argument is not an option.
https://github.com/apache/airflow/blob/d67ac5932dabbf06ae733fc57b48491a8029b8c2/airflow/utils/types.py#L28-L44
So potentially we could use it here, e.g.:
If hook argument cmd_timeout is NOTSET and Connection extra argument set
than use from connection
If hook argument cmd_timeout is NOTSET and Connection extra argument **not
set** than use CMD_TIMEOUT
If hook argument set to any value rather than NOTSET than use this value and
ignore value from connection
And of course we need to tests all combination in unittests, just for sure
that we do not break anything as well as we correctly process every possible
case
--
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]