Commit d3ed1927 by serpucga

Beep at failure too

parent 6a15c8d2
......@@ -35,6 +35,8 @@ else:
logger = logging.getLogger(__name__)
# Initialize some variables
duration = 1
freq = 440
script_dir = os.path.dirname(__file__)
output_dir = os.path.join(script_dir, "pymongodump", args.database)
header_file = os.path.join(script_dir, "config", "header.txt")
......@@ -98,6 +100,7 @@ try:
writer_worker.start()
except Exception:
logger.error("There was a failure in the filesystem writer", exc_info=True)
os.system("play -nq -t alsa synth {} sine {}".format(duration, freq))
sys.exit(1)
# Launch pool of workers to perform the format conversion
......@@ -107,10 +110,12 @@ try:
except utils.ExceptionAtPage as exc:
logger.error("Error detected at page {}".format(exc.error_page))
task_queue.put((exc.error_page, "ERROR"))
os.system("play -nq -t alsa synth {} sine {}".format(duration, freq))
sys.exit(1)
except (Exception, KeyboardInterrupt):
logger.error("Error detected", exc_info=True)
task_queue.put((-2, "ERROR"))
os.system("play -nq -t alsa synth {} sine {}".format(duration, freq))
sys.exit(1)
task_queue.put((-1, "END"))
......@@ -124,6 +129,7 @@ try:
except (Exception, KeyboardInterrupt):
logger.error("The collection was converted correctly to CSV, but something"
+ " failed when generating the metadata file", exc_info=True)
os.system("play -nq -t alsa synth {} sine {}".format(duration, freq))
sys.exit(1)
if globals.timing:
logger.critical(
......@@ -133,7 +139,5 @@ if globals.timing:
"Total execution time: {}s"
.format(time.time() - time0))
duration = 1
freq = 440
os.system("play -nq -t alsa synth {} sine {}".format(duration, freq))
logger.info("Conversion completed successfully!!")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment