No. This the prelude to me writing a real life python program.
Lots of "real life python programs" don't need threading or other
spawned processes...
Your 56K dial-up is probably only running around 44kbps (no "56K"
modem, in the US, ever reaches that speed -- the FCC limited the maximum
allowed bit-rate on phone lines to around 52kbps, and since the actual
speed is affected by the cleanliness of the signal on the lines rarely
hits even 50kbps). Assuming 44,000bps, no handshake/protocol overhead,
that comes to 5,500bytes/sec => 330,000 bytes/min => 4,950,000 in 15
minutes... call it 5MB... What type of processing are you planning that
would take any fairly recent computer 15 minutes to handle 5MB of data
-- 5MB is about 6 minutes of MP3 audio, or 3-4 3.5MP JPEGs
Presuming your processing really does have the risk of running over
into the next download interval, I'd suggest at most two threads
(pseudo-code):
worklist = Queue.Queue()
def downloader():
while True:
startTime = time.time()
#imagine proper format conversions for strings
filename = BASEFILENAME + startTime
doDownload(filename)
worklist.put(filename)
#compute next download time taking into account elapsed time
sleep (startTime + 30mins) - time.time()
def processor():
while True:
filename = worklist.get()
doFileProcessing(filename)
This ensures that downloads start every 30 minutes (unless a
download runs over 30 minutes, in which case the sleep is negative, and
probably returns immediately) regardless of the processing duration. It
also ensures that the files are processed IN ORDER OF DOWNLOAD with NO
OVERLAPS.
Threading is probably suited, since the downloader is blocked on a
sleep call, letting the processor run full speed; and if the processor
is fast, it will block waiting for the next file to be available,
meaning the downloader gets full CPU usage.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/