Skip to content

Commit

Permalink
refactor sweepers_driver to remove potential for confusion over execu…
Browse files Browse the repository at this point in the history
…tion order
  • Loading branch information
alexdunnjpl committed Aug 30, 2023
1 parent 30e9ab2 commit ce5b9ef
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions docker/sweepers_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#

import functools
import inspect
import json
import logging
import os
Expand Down Expand Up @@ -94,6 +95,7 @@

log_level = parse_log_level(os.environ.get('LOGLEVEL', 'INFO'))


def run_factory(sweeper_f: Callable) -> Callable:
return functools.partial(
sweeper_f,
Expand All @@ -106,15 +108,20 @@ def run_factory(sweeper_f: Callable) -> Callable:
)


run_provenance = run_factory(provenance.run)
run_ancestry = run_factory(ancestry.run)
run_repairkit = run_factory(repairkit.run)
# Define sweepers to be run here, in order of execution
sweepers = [
repairkit.run,
provenance.run,
ancestry.run
]

sweeper_descriptions = [inspect.getmodule(f).__name__ for f in sweepers]
log.info(f'Running sweepers: {sweeper_descriptions}')

log.info('Running sweepers')
execution_begin = datetime.now()

run_repairkit()
run_provenance()
run_ancestry()
for sweeper in sweepers:
run_sweeper_f = run_factory(sweeper)
run_sweeper_f()

log.info(f'Sweepers successfully executed in {get_human_readable_elapsed_since(execution_begin)}')

0 comments on commit ce5b9ef

Please sign in to comment.