Commit 5ede388fa691f38c9857ceabd32d17e736619326

Authored by Goutte
1 parent c50cc9d8

Make sure failed CSV files are deleted, so we can re-try.

Showing 1 changed file with 3 additions and 1 deletions   Show diff stats
@@ -3,7 +3,7 @@ import datetime @@ -3,7 +3,7 @@ import datetime
3 import StringIO 3 import StringIO
4 from math import sqrt 4 from math import sqrt
5 5
6 -from os import listdir, environ 6 +from os import listdir, environ, remove as removefile
7 from os.path import isfile, join, abspath, dirname 7 from os.path import isfile, join, abspath, dirname
8 8
9 import csv 9 import csv
@@ -351,6 +351,8 @@ def generate_csv_file_if_needed(target_config, started_at, stopped_at): @@ -351,6 +351,8 @@ def generate_csv_file_if_needed(target_config, started_at, stopped_at):
351 stopped_at=stopped_at)) 351 stopped_at=stopped_at))
352 log.info("Generation of '%s' done." % filename) 352 log.info("Generation of '%s' done." % filename)
353 except Exception as e: 353 except Exception as e:
  354 + if isfile(local_csv_file):
  355 + removefile(local_csv_file)
354 abort(500, "Failed creating CSV '%s' : %s" % (filename, e)) 356 abort(500, "Failed creating CSV '%s' : %s" % (filename, e))
355 357
356 358