def setup_slurmd()

in azure-slurm-install/install.py [0:0]


def setup_slurmd(s: InstallSettings) -> None:
    slurmd_config = f"SLURMD_OPTIONS=-b -N {s.node_name}"
    if s.dynamic_feature or s.dynamic_config:
        if s.dynamic_feature:
            override_conf = ""
            # Dynamic GPU nodes have to have their gres manually defined by the user before they can be started.
            # Check if gres is defined for this node and then add that to configuration options.
            gpu_count = get_gres_count(s.node_name)
            if gpu_count > 0:
                gres_str = f"gres=gpu:{gpu_count}"
                override_conf += f" {gres_str}"
            override_conf += f" Feature={s.dynamic_feature}"
            dynamic_config = f"-Z --conf \"{override_conf}\""
        else:
            # If user has supplied us dynamic config in the template.
            #TODO: dynamic_config will be removed for 4.x
            dynamic_config = f"{s.dynamic_config}"
        logging.debug("Dynamic config: %s" % dynamic_config)
        slurmd_config = f"SLURMD_OPTIONS={dynamic_config} -N {s.node_name}"
        if "-b" not in slurmd_config.split():
            slurmd_config = slurmd_config + " -b"

    ilib.file(
        "/etc/sysconfig/slurmd" if s.platform_family == "rhel" else "/etc/default/slurmd",
        content=slurmd_config,
        owner=s.slurm_user,
        group=s.slurm_grp,
        mode="0700",
    )
    ilib.enable_service("slurmd")