def _run_clustermgtd()

in src/slurm_plugin/clustermgtd.py [0:0]


def _run_clustermgtd(config_file):
    """Run clustermgtd actions."""
    config = ClustermgtdConfig(config_file)
    cluster_manager = ClusterManager(config=config)
    try:
        while True:
            # Get loop start time
            start_time = datetime.now(tz=timezone.utc)
            # Get program config
            try:
                config = ClustermgtdConfig(config_file)
                cluster_manager.set_config(config)
            except Exception as e:
                log.warning(
                    "Unable to reload daemon config from %s, using previous one.\nException: %s",
                    config_file,
                    e,
                )
            # Configure root logger
            try:
                fileConfig(config.logging_config, disable_existing_loggers=False)
            except Exception as e:
                log.warning(
                    "Unable to configure logging from %s, using default logging settings.\nException: %s",
                    config.logging_config,
                    e,
                )
            # Manage cluster
            cluster_manager.manage_cluster()
            sleep_remaining_loop_time(config.loop_time, start_time)
    finally:
        cluster_manager.shutdown()