Skip to content

Commit

Permalink
Move main function as per nitpick
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Nov 20, 2023
1 parent fc8b503 commit e419483
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions python/nav/bin/sortedstats_cacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
_logger = logging.getLogger('nav.sortedstats_cacher')


def main():
init_generic_logging(logfile=LOGFILE, stderr=False, read_config=True)
timeframe = get_parser().parse_args().timeframe
pidfile = f"sortedstats_cacher_{timeframe}.pid"
exit_if_running(pidfile)
writepidfile(pidfile)
config = SortedStatsConfig()
run(timeframe, config)


def run(timeframe, config):
_logger.info("Running for timeframe %s", timeframe)
reports = config.get_reports(timeframe)
Expand Down Expand Up @@ -48,15 +58,5 @@ def exit_if_running(pidfile):
exit(1)


def main():
init_generic_logging(logfile=LOGFILE, stderr=False, read_config=True)
timeframe = get_parser().parse_args().timeframe
pidfile = f"sortedstats_cacher_{timeframe}.pid"
exit_if_running(pidfile)
writepidfile(pidfile)
config = SortedStatsConfig()
run(timeframe, config)


if __name__ == '__main__':
main()

0 comments on commit e419483

Please sign in to comment.