コード例 #1
0
		elif key in backup: 
			xml_file.write("\t\t\t<controller>backup</controller>\n")
		else:
			xml_file.write("\t\t\t<controller></controller>\n")

		xml_file.write('\t\t</node>\n')
	xml_file.write( "\t</nodes>\n")

	pyslurm.slurm_free_node_info_msg(b)

	#
	# XML output of Partttions
	#

	a, b = pyslurm.slurm_load_partitions()
	part_dict = pyslurm.get_partition_data(b)

	if len(part_dict) > 0:

	xml_file.write("\t<partitions>\n")
	for key, value in part_dict.iteritems():

		xml_file.write('\t\t<partition>\n')
		for part_key, part_value in value.iteritems():
		xml_file.write("\t\t\t<%s>%s</%s>\n" % (part_key, part_value, part_key))

		xml_file.write('\t\t</partition>\n')

	xml_file.write("\t</partitions>\n")

	pyslurm.slurm_free_partition_info_msg(b)
コード例 #2
0
ファイル: slurm_xml.py プロジェクト: ralphbean/pyslurm
        xml_file.write("\t\t\t<features>%s</features>\n" % value[9])

        if key in controllers[0]:
            xml_file.write("\t\t\t<controller>Primary</controller>\n")
        elif key in controllers[1]:
            xml_file.write("\t\t\t<controller>Secondary</controller>\n")
        else:
            xml_file.write("\t\t\t<controller></controller>\n")

        xml_file.write("\t\t\t<reason>%s</reason>\n" % value[10])
        xml_file.write('\t\t</node>\n')
    xml_file.write("\t</nodes>\n")
pyslurm.slurm_free_node_info_msg(b)

a, b = pyslurm.slurm_load_partitions()
partitions = pyslurm.get_partition_data(b)
if len(partitions) > 0:
    xml_file.write("\t<partitions>\n")
    for key, value in partitions.iteritems():
        xml_file.write('\t\t<partition>\n')
        xml_file.write("\t\t\t<id>%s</id>\n" % key)
        xml_file.write("\t\t\t<lastUpdate>%s</lastUpdate>\n" % value[0])
        xml_file.write("\t\t\t<maxTime>%s</maxTime>\n" % value[1])
        xml_file.write("\t\t\t<maxNodes>%s</maxNodes>\n" % value[2])
        xml_file.write("\t\t\t<minNodes>%s</minNodes>\n" % value[3])
        xml_file.write("\t\t\t<totalNodes>%s</totalNodes>\n" % value[4])
        xml_file.write("\t\t\t<totalCpus>%s</totalCpus>\n" % value[5])
        xml_file.write("\t\t\t<nodeScaling>%s</nodeScaling>\n" % value[6])
        xml_file.write("\t\t\t<defaultPartition>%s</defaultPartition>\n" %
                       value[7])
        xml_file.write("\t\t\t<hidden>%s</hidden>\n" % value[8])