Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-26 08:40:22

0001 #!/usr/bin/env python3
0002 """Refresh cached System status rows.
0003 
0004 Standalone doer for the epicprod ops agent. This is intentionally not a
0005 Django management command: the web page reads cached rows; the agent runs this
0006 script for manual and periodic refreshes.
0007 """
0008 
0009 import argparse
0010 import os
0011 import sys
0012 
0013 THIS_DIR = os.path.dirname(os.path.abspath(__file__))
0014 sys.path.insert(0, os.path.join(THIS_DIR, '..', 'src'))
0015 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'swf_monitor_project.settings')
0016 
0017 import django  # noqa: E402
0018 django.setup()
0019 
0020 from monitor_app.system_status import compact_refresh_report, refresh_system_status  # noqa: E402
0021 
0022 
0023 def main(argv):
0024     ap = argparse.ArgumentParser(description='Refresh cached SWF monitor system status.')
0025     ap.add_argument('--source', default='manual', help='Refresh source label stored in JSON data.')
0026     ap.add_argument('--only', action='append', default=[],
0027                     help='Collector name to refresh. Repeat for multiple collectors.')
0028     args = ap.parse_args(argv[1:])
0029 
0030     rows = refresh_system_status(selected=args.only or None, source=args.source)
0031     print(compact_refresh_report(rows))
0032     return 0
0033 
0034 
0035 if __name__ == '__main__':
0036     sys.exit(main(sys.argv))