Python Restart logic
· March 14, 2015
I have python program which reads input file; validate the file record and apply some transformation and create JSON and load/update into MongoDB.
Lets consider if this program fails due to some reason while processing 100th record so till this time I have inserted 99 record in database so when we restart it should skip 99 records; start reading/validation from 100th record and load into database.
How do we do this in python code, please suggest.
Post a Reply
|Oldest Newest Rating|
· March 17, 2015
I dont know your exact code but you could do this with a counter...
So if it fails at 99 the number gets savet to an external file and when you restart the program it reads 99 from this file
and starts from there on processing/ or starts the loop at 99 considering you are just using one loop.
It would be realy helpfull if you could post the code.
This section is all about snakes! Just kidding.
|Bucky Roberts Administrator|