import pyslurm steps = pyslurm.slurm_get_job_steps(5, 0, 2) print steps for job, job_step in sorted(steps.iteritems()): print "Job: %s" % job for step in sorted(job_step.iterkeys()): print "\tStep: %s" % step step_info = pyslurm.slurm_job_step_layout_get(job, step) for task in sorted(step_info.iterkeys()): print "\t\t%s:\t%s" % (task, step_info[task])
import pyslurm print pyslurm.slurm_get_job_steps(0, 0, 0) #print pyslurm.slurm_job_step_layout_get(8017,1)
xml_file.write("\t\t\t<priority>%s</priority>\n" % value[13]) xml_file.write("\t\t\t<nodes>%s</nodes>\n" % value[14]) xml_file.write("\t\t\t<partition>%s</partition>\n" % value[15]) xml_file.write("\t\t\t<numProcs>%s</numProcs>\n" % value[16]) #xml_file.write("\t\t\t<numNodes>%s</numNodes>\n" % value[17]) xml_file.write("\t\t\t<numNodes>%s</numNodes>\n" % len(string.split(value[14], ','))) xml_file.write("\t\t\t<execNodes>%s</execNodes>\n" % value[18]) xml_file.write("\t\t\t<shared>%s</shared>\n" % value[19]) xml_file.write("\t\t\t<contigous>%s</contigous>\n" % value[20]) xml_file.write("\t\t\t<cpusPerTask>%s</cpusPerTask>\n" % value[21]) xml_file.write("\t\t\t<account>%s</account>\n" % value[22]) xml_file.write("\t\t\t<comment>%s</comment>\n" % value[23]) xml_file.write("\t\t\t<reason>%s</reason>\n" % value[24]) steps = pyslurm.slurm_get_job_steps(value[1], 0, 0) for jobstep in steps: xml_file.write('\t\t\t<jobstep>\n') xml_file.write('\t\t\t\t<id>%s</id>\n' % jobstep[1]) xml_file.write('\t\t\t\t<partition>%s</partition>\n' % jobstep[4]) xml_file.write('\t\t\t\t<name>%s</name>\n' % jobstep[6]) step_info = pyslurm.slurm_job_step_layout_get(value[1], jobstep[1]) nodes = [] for task_info in step_info: nodes.append('%s*%d' % (task_info[0], len(task_info[1]))) xml_file.write('\t\t\t\t<tasks>%s</tasks>\n' % string.join(nodes, ',')) xml_file.write('\t\t\t</jobstep>\n') xml_file.write('\t\t</job>\n')
# a, b = pyslurm.slurm_load_jobs() jobs = pyslurm.get_job_data(b) if len(jobs) > 0: xml_file.write("\t<jobs>\n") for key, value in jobs.iteritems(): xml_file.write('\t\t<job>\n') xml_file.write("\t\t\t<id>%s</id>\n" % key) for job_key in sorted(value.iterkeys()): xml_file.write("\t\t\t<%s>%s</%s>\n" % (job_key, value[job_key], job_key)) steps = pyslurm.slurm_get_job_steps(key, 0, 0) for job, job_step in sorted(steps.iteritems()): xml_file.write('\t\t\t<jobstep>\n') for step in sorted(job_step.iterkeys()): xml_file.write("\t\t\t\t<id>%s</id>\n" % step) step_info = pyslurm.slurm_job_step_layout_get(int(job), int(step)) for task in sorted(step_info.iterkeys()): xml_file.write('\t\t\t\t<%s>%s</%s>\n' % (task, step_info[task], task)) xml_file.write('\t\t\t</jobstep>\n') xml_file.write('\t\t</job>\n') xml_file.write("\t</jobs>\n")