Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Detect command timeouts? #16

Open
rrauenza opened this issue Dec 18, 2015 · 0 comments
Open

Detect command timeouts? #16

rrauenza opened this issue Dec 18, 2015 · 0 comments

Comments

@rrauenza
Copy link

I was reviewing the code per my other bug report -- at one point I thought maybe the commands were timing out. I noticed a timeout isn't included in exec_command(). I'm wondering if that might be something you want to add, i.e.,

     def run_cmds(self, ssh_job,):
         for rho_cmd in ssh_job.rho_cmds:
             output = []
             for cmd_string in rho_cmd.cmd_strings:
-                stdin, stdout, stderr = self.ssh.exec_command(cmd_string)
-                output.append((stdout.read(), stderr.read()))
+                try:
+                    stdin, stdout, stderr = self.ssh.exec_command(cmd_string, timeout=30)
+                    output.append((stdout.read(), stderr.read()))
+                except paramiko.SSHException as e:
+                    log.error("Exception on %s: %s" % (ssh_job.ip, e))
             rho_cmd.populate_data(output)

Also, on the catch, perhaps stdin, stdout, stderr ought to be set to "", "", "". ...And the value of 30 was arbitrary.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant