I am working on a python script that connects to a remote linux machine using paramiko. After the connection is established, I want to run a command on remote machine. This command first creates few files on the remote machine and then do some operations on those files (it may take from 1 sec to 1 min to 10min for the command execution). Next step, I am transporting those files on my local machine using
paramiko.SFTPClient.from_transport(transport).get(filename)
This command is working fine and collecting the files. But the problem is it doesnt wait until all the operations on the files is complete. As a result, I am not getting proper data. Can anyone please help me here?
I found the below commands for this purpose,
stdin, stdout, stderr = ssh_conn_ssh.exec_command(create_and_operate_on_files)
(Note: stdout, stderr etc are just given for namesake. I dont bother about their output)
But this command sh_conn_ssh.exec_command(create_and_operate_on_files)
doesnt wait for the command create_and_operate_on_files
to get completed. And as a result, I am getting files while they are still being operated upon.