aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-07-18 13:32:11 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-07-18 13:32:11 -0300
commit0fae0715f8e504284386def63b4f512a87a4a801 (patch)
tree46e2c5ef405d45555fb51eb06532b211d56c3c71
parent49f9be7d6f29add47cd72bf2b9ef506baa746079 (diff)
downloadgrab-queue-0fae0715f8e504284386def63b4f512a87a4a801.tar.gz
grab-queue-0fae0715f8e504284386def63b4f512a87a4a801.tar.bz2
Handle MemoryError
-rwxr-xr-xgrab-queue10
1 files changed, 7 insertions, 3 deletions
diff --git a/grab-queue b/grab-queue
index dbdc030..bfeaf40 100755
--- a/grab-queue
+++ b/grab-queue
@@ -271,13 +271,13 @@ if __name__ == "__main__":
parser.set_defaults(progress=True)
args = parser.parse_args()
+ # Initialize our dumper
+ queue = GrabQueue(args)
+
# Dispatch
try:
start_time = time.time()
- # Initialize our dumper
- queue = GrabQueue(args)
-
# Record date and invocation
logs = ''.join(args.dest) + os.sep + 'logs' + os.sep
queue.download.ensuredir(logs)
@@ -298,6 +298,10 @@ if __name__ == "__main__":
elapsed = open(logs + 'grab-queue.duration', 'a')
elapsed.write(str(start_time) + '\t' + str(end_time) + '\t' + duration)
elapsed.close()
+ except MemoryError as e:
+ print(e)
+ queue.dump_stats()
+ exit(1)
except (FileNotFoundError, KeyboardInterrupt, subprocess.CalledProcessError) as e:
print(e)
exit(1)