in scripts/conf.py [0:0]
def partitionlines(partition, lkp: util.Lookup) -> str:
"""Make a partition line for the slurm.conf"""
MIN_MEM_PER_CPU = 100
def defmempercpu(nodeset: str) -> int:
template = lkp.cfg.nodeset.get(nodeset).instance_template
machine = lkp.template_machine_conf(template)
return max(MIN_MEM_PER_CPU, machine.memory // machine.cpus)
defmem = min(
map(defmempercpu, partition.partition_nodeset), default=MIN_MEM_PER_CPU
)
nodesets = list(
chain(
partition.partition_nodeset,
partition.partition_nodeset_dyn,
partition.partition_nodeset_tpu,
)
)
is_tpu = len(partition.partition_nodeset_tpu) > 0
is_dyn = len(partition.partition_nodeset_dyn) > 0
oversub_exlusive = partition.enable_job_exclusive or is_tpu
power_down_on_idle = partition.enable_job_exclusive and not is_dyn
line_elements = {
"PartitionName": partition.partition_name,
"Nodes": ",".join(nodesets),
"State": "UP",
"DefMemPerCPU": defmem,
"SuspendTime": 300,
"Oversubscribe": "Exclusive" if oversub_exlusive else None,
"PowerDownOnIdle": "YES" if power_down_on_idle else None,
**partition.partition_conf,
}
return dict_to_conf(line_elements)