You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/bash
for i in {1..10000}
do
echo "$i. long output long output long output"
done
echo "DONE"
long_output.robot
*** Settings ***
Library SSHLibrary
Library utils.py
*** Variables ***
${HOST}
${USERNAME}
${PASSWORD}
*** Test Cases ***
Send file
Open Connection ${HOST} timeout=120
Login ${USERNAME} ${PASSWORD}
Put File ./long_output.sh /root/
Close All Connections
Paramiko test
paramiko_write cd /root && time ./long_output.sh ${HOST} ${USERNAME} ${PASSWORD}
SSHLibrary test
Open Connection ${HOST} timeout=120
Login ${USERNAME} ${PASSWORD}
Write cd /root && time ./long_output.sh
Read Until DONE
Close All Connections
utils.py
import paramiko
from robot.api.deco import keyword, library
import robot.api.logger as logger
@library(scope='GLOBAL')
class utils:
@keyword
def paramiko_write(self, cmd, host, username, password):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, 22, username, password, timeout=10)
stdin, stdout, stderr = ssh.exec_command(cmd)
output = []
for line in stdout.readlines():
logger.info(line)
output.append(line)
ssh.close()
return "\n".join(output)
This is how I started Robot: robot -d ./results -v HOST:<ip> -v USERNAME:<user> -v PASSWORD:<pass> long_output.robot
And finally the result of running above:
I am running this from virtual machine with Fedora and machine I am connecting to has CentOS.
I am using Python3.
Check commit 8e77942
The bottleneck may be here in _read_until. self.read_char reads only a character each loop. And need match every output. It is really time consuming for long output.
Should use Execute Command keyword to get the output and check.
Hi,
I have similar (or same) issue as discussed in following tickets: #338, #347, #151 and #203 - basically
Read Until
is slow.I have created setup to compare
Read Until
directly toParamiko
, that comparison is not exactly 1-to-1 but I think it is enough to show the problem.requirements.txt
long_output.sh
long_output.robot
utils.py
This is how I started Robot:
robot -d ./results -v HOST:<ip> -v USERNAME:<user> -v PASSWORD:<pass> long_output.robot
And finally the result of running above:
I am running this from virtual machine with Fedora and machine I am connecting to has CentOS.
I am using Python3.
All files to download:
shhlib_slow_read_until.zip
Any idea where problem might be?
Thanks,
Michał Witwicki
The text was updated successfully, but these errors were encountered: