diff options
author | Matt Singleton <msingleton@aclu.org> | 2017-10-14 19:31:11 -0400 |
---|---|---|
committer | Matt Singleton <msingleton@aclu.org> | 2017-10-14 19:31:11 -0400 |
commit | 40842e8431a8c248c0d767c3b24a21d95bc136b4 (patch) | |
tree | 2f44a3b3c820e5df58406c8fdffed225657b9812 | |
parent | 4fa6bb4c64e90eb5c3c11074cf83747f01bd7fd7 (diff) |
debug mode causes exceptions to raise immediately
-rwxr-xr-x | unbiased/main.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/unbiased/main.py b/unbiased/main.py index 7b057ea..89071b1 100755 --- a/unbiased/main.py +++ b/unbiased/main.py @@ -68,7 +68,7 @@ def main(): while True: logger.info('Starting crawl') start = time.time() - run(args.webroot, args.sources) + run(args.webroot, args.sources, args.debug) finish = time.time() runtime = finish - start sleeptime = crawl_frequency - runtime @@ -78,12 +78,11 @@ def main(): if sleeptime > 0: time.sleep(sleeptime) -def run(webroot, source_names): +def run(webroot, source_names, debug_mode=False): logger.debug('Running with webroot="{}" for sources="{}"'.format(webroot, source_names)) sources = get_sources() - print(sources) if source_names is None: sources = sources.values() else: @@ -99,6 +98,8 @@ def run(webroot, source_names): built_sources.append(source.build()) break except Exception as ex: + if debug_mode is True: + raise tries += 1 if tries == 3: logger.error('Build failed. source={} ex={}'.format(source.name, ex)) |