[Tutor] ftp transfer - queue & retry pattern

captnswing captnswing at gmx.net
Sat Nov 12 18:11:18 CET 2005


Hello,
I want to write a module that transfers a given file to a given  
destination with a given protocol (ftp, sftp, scp)
to start out, just ftp would be sufficient
the destination machines are sometimes unavailable, or the transfer  
fails sometimes due to connection problems

I have several questions (sorry....):
	1) python ftplib or curl via commands.getoutput(...)? what are the  
benefits / drawbacks (portability is not an issue for me, and I like  
curl a lot)
	2) Is there a simple way to create a subprocess(?) that I can  
dispatch my transfer jobs to from my main script.
	     The goal is that my main script can proceed without beeing hung  
by the transfer process
	3) that subprocess would need a queue, that collects all transfer  
jobs. can you give me some hints on how that could be done in python
	4) the subprocess (?) would try to transfer all jobs one after another
	     if one transfer fails, retry after a certain time period (say  
2, 5, 10, 20, 40 min) and stop after maxnum retries
	    how could I code this nicely in python without resorting to if  
then else etc?

or is there a module that does 1)-4) out there somewhere already?
thanks for any insight you might have
-frank



More information about the Tutor mailing list