question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SSHOperator ignores cmd_timeout

See original GitHub issue

Apache Airflow Provider(s)

ssh

Versions of Apache Airflow Providers

No response

Apache Airflow version

2.4.1

Operating System

linux

Deployment

Other

Deployment details

No response

What happened

Hi,

SSHOperator documentation states that we should be using cmd_timeout instead of timeout

:param timeout: (deprecated) timeout (in seconds) for executing the command. The default is 10 seconds.
        Use conn_timeout and cmd_timeout parameters instead.

But the code doesn’t use cmd_timeout at all - and it’s still passing self.timeout when running the ssh command:

return self.ssh_hook.exec_ssh_client_command(
            ssh_client, command, timeout=self.timeout, environment=self.environment, get_pty=self.get_pty
        )

It seems to me that we should self.cmd_timeout here instead. When creating the hook, it correctly uses self.conn_timeout.

I’ll try to work on a PR for this.

What you think should happen instead

No response

How to reproduce

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
punx120commented, Oct 26, 2022

Ok done - I updated the PR and fix/added tests.

1reaction
punx120commented, Oct 25, 2022

Right, i’ll give it a try an update the above PR

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSH operator error: timed out in Airflow while connecting with ...
The problem is solved, actually, the port number 8888 was incorrect. It worked with port number 22.
Read more >
SqlCommand.CommandTimeout is being ignored - MSDN
I am getting the following exception because of what appears to be SQL command timeout issue: System.Data.SqlClient.
Read more >
[airflow] branch main updated: Refactor SSHOperator so a ...
[airflow] branch main updated: Refactor SSHOperator so a subclass can ... + self.log.info("ssh_conn_id is ignored when ssh_hook is provided.
Read more >
Source code for airflow.contrib.operators.ssh_operator
[docs]class SSHOperator(BaseOperator): """ SSHOperator to execute commands on given remote host using the ssh_hook. :param ssh_hook: predefined ssh_hook to ...
Read more >
SSH Connection - Apache Airflow Documentation
The SSH connection type provides connection to use SSHHook to run commands on a remote server using SSHOperator or transfer file from/to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found