reconcile_data_research.py 807 B

1234567891011121314151617181920212223242526
  1. from __future__ import annotations
  2. import argparse
  3. import json
  4. from app import create_app
  5. def run(reconciler, *, repair=False):
  6. return reconciler.reconcile(repair=repair)
  7. def main():
  8. parser = argparse.ArgumentParser(description="Reconcile data-research control and projection stores")
  9. parser.add_argument("--repair", action="store_true", help="repair rebuildable projections")
  10. args = parser.parse_args()
  11. app = create_app()
  12. with app.app_context():
  13. factory = app.extensions.get("data_research_reconciler_factory")
  14. if factory is None:
  15. raise RuntimeError("data-research reconciliation adapters are not configured")
  16. print(json.dumps(run(factory(), repair=args.repair), ensure_ascii=False, sort_keys=True))
  17. if __name__ == "__main__":
  18. main()