示例#1
0
def display(node_dict):

    if node_dict:

        date_fields = [
            'boot_time', 'slurmd_start_time', 'last_update', 'reason_time'
        ]

        print('{0:*^80}'.format(''))
        for key, value in node_dict.iteritems():

            print("{0} :".format(key))
            for part_key in sorted(value.iterkeys()):

                if part_key in date_fields:
                    ddate = value[part_key]
                    if ddate == 0:
                        print("\t{0:<17} : N/A".format(part_key))
                    else:
                        ddate = pyslurm.epoch2date(ddate)
                        print("\t{0:<17} : {1}".format(part_key, ddate))
                elif ('reason_uid' in part_key and value['reason'] is None):
                    print("\t{0:<17} : ".format(part_key))
                else:
                    print("\t{0:<17} : {1}".format(part_key, value[part_key]))

            print('{0:*^80}'.format(''))
示例#2
0
def display(job_dict):

    if job_dict:

        time_fields = ['time_limit']

        date_fields = [
            'start_time', 'submit_time', 'end_time', 'eligible_time',
            'resize_time'
        ]

        for key, value in sorted(job_dict.iteritems()):

            print "JobID %s :" % key
            for part_key in sorted(value.iterkeys()):

                if part_key in time_fields:
                    print "\t%-20s : Infinite" % (part_key)
                    continue

                if part_key in date_fields:

                    if value[part_key] == 0:
                        print "\t%-20s : N/A" % (part_key)
                    else:
                        ddate = pyslurm.epoch2date(value[part_key])
                        print "\t%-20s : %s" % (part_key, ddate)
                else:
                    print "\t%-20s : %s" % (part_key, value[part_key])

            print "-" * 80
示例#3
0
def display(block_dict):

    if block_dict:

        date_fields = [ ]

        print('{0:*^80}'.format(''))

        for key, value in block_dict.iteritems():

            print("{0} :".format(key))
            for part_key in sorted(value.iterkeys()):

                if part_key in date_fields:
                    ddate = value[part_key]
                    if ddate == 0:
                        print("\t{0:<17} : N/A".format(part_key))
                    elif ('reason_uid' in part_key) and (value['reason'] is None):
                        print("\t{0:<17} :".format(part_key))
                    else:
                        ddate = pyslurm.epoch2date(ddate)
                        print("\t{0:<17} : {1}".format(part_key, ddate))
                elif part_key == 'connection_type':
                    print("\t{0:<17} : {1}".format(part_key, pyslurm.get_connection_type(value[part_key])))
                elif part_key == 'state':
                    print("\t{0:<17} : {1}".format(part_key, value[part_key]))
                else:
                    print("\t{0:<17} : {1}".format(part_key, value[part_key]))

            print('{0:*^80}'.format(''))
示例#4
0
def display(block_dict):

    if block_dict:

        date_fields = []

        print('{0:*^80}'.format(''))

        for key, value in block_dict.iteritems():

            print("{0} :".format(key))
            for part_key in sorted(value.iterkeys()):

                if part_key in date_fields:
                    ddate = value[part_key]
                    if ddate == 0:
                        print("\t{0:<17} : N/A".format(part_key))
                    elif ('reason_uid'
                          in part_key) and (value['reason'] is None):
                        print("\t{0:<17} :".format(part_key))
                    else:
                        ddate = pyslurm.epoch2date(ddate)
                        print("\t{0:<17} : {1}".format(part_key, ddate))
                elif part_key == 'connection_type':
                    print("\t{0:<17} : {1}".format(
                        part_key,
                        pyslurm.get_connection_type(value[part_key])))
                elif part_key == 'state':
                    print("\t{0:<17} : {1}".format(part_key, value[part_key]))
                else:
                    print("\t{0:<17} : {1}".format(part_key, value[part_key]))

            print('{0:*^80}'.format(''))
示例#5
0
def display(res_dict):
    """Format output"""
    if res_dict:

        date_fields = ["end_time", "start_time"]

        for res_key, res_value in res_dict.items():

            print(f"{res_key} :")
            for reservation in sorted(res_value.keys()):

                if reservation in date_fields:

                    if res_value[reservation] == 0:
                        print(f"\t{reservation:<20} : N/A")
                    else:
                        ddate = pyslurm.epoch2date(res_value[reservation])
                        print(f"\t{reservation:<20} : {ddate}")
                else:
                    print(f"\t{reservation:<20} : {res_value[reservation]}")

        print(f"{'':*^80}")

        now = int(time.time())
        resv_state = "INACTIVE"
        if res_value["start_time"] <= now <= res_value["end_time"]:
            resv_state = "ACTIVE"

        print(f"\t{'state':-20s} : {resv_state}\n")
示例#6
0
def display(block_dict):

    if block_dict:

        date_fields = []

        print "-" * 80

        for key, value in block_dict.iteritems():

            print "%s :" % (key)
            for part_key in sorted(value.iterkeys()):

                if part_key in date_fields:
                    ddate = value[part_key]
                    if ddate == 0:
                        print "\t%-17s : N/A" % (part_key)
                    elif ('reason_uid'
                          in part_key) and (value['reason'] is None):
                        print "\t%-17s :" % part_key
                    else:
                        ddate = pyslurm.epoch2date(ddate)
                        print "\t%-17s : %s" % (part_key, ddate)
                elif part_key == 'connection_type':
                    print "\t%-17s : %s" % (
                        part_key, pyslurm.get_connection_type(value[part_key]))
                elif part_key == 'state':
                    print "\t%-17s : %s" % (part_key, value[part_key])
                else:
                    print "\t%-17s : %s" % (part_key, value[part_key])

            print "-" * 80
示例#7
0
def display(job_dict):

    if job_dict:

        time_fields = ['time_limit']

        date_fields = ['start_time',
                'submit_time',
                'end_time',
                'eligible_time',
                'resize_time']

        for key, value in sorted(job_dict.iteritems()):

            print("JobID {0} :".format(key))
            for part_key in sorted(value.iterkeys()):

                if part_key in time_fields:
                    print("\t{0:<20} : Infinite".format(part_key))
                    continue

                if part_key in date_fields:

                    if value[part_key] == 0:
                        print("\t{0:<20} : N/A".format(part_key))
                    else:
                        ddate = pyslurm.epoch2date(value[part_key])
                        print("\t{0:<20} : {1}".format(part_key, ddate))
                else:
                    print("\t{0:<20} : {1}".format(part_key, value[part_key]))
                
            print("-" * 80)
示例#8
0
def display(job_dict):

    if job_dict:

        time_fields = ["time_limit"]

        date_fields = ["start_time", "submit_time", "end_time", "eligible_time", "resize_time"]

        for key, value in sorted(job_dict.iteritems()):

            print "JobID %s :" % key
            for part_key in sorted(value.iterkeys()):

                if part_key in time_fields:
                    print "\t%-20s : Infinite" % (part_key)
                    continue

                if part_key in date_fields:

                    if value[part_key] == 0:
                        print "\t%-20s : N/A" % (part_key)
                    else:
                        ddate = pyslurm.epoch2date(value[part_key])
                        print "\t%-20s : %s" % (part_key, ddate)
                else:
                    print "\t%-20s : %s" % (part_key, value[part_key])

            print "-" * 80
示例#9
0
def display(job_dict):

	if job_dict:

		time_fields = ['time_limit']

		date_fields = ['start_time',
				'submit_time',
				'end_time',
				'eligible_time',
				'resize_time']

		for key, value in sorted(job_dict.iteritems()):

			print("JobID {0} :".format(key))
			for part_key in sorted(value.iterkeys()):

				if part_key in time_fields:
					print("\t{0:<20} : Infinite".format(part_key))
					continue

				if part_key in date_fields:

					if value[part_key] == 0:
						print("\t{0:<20} : N/A".format(part_key))
					else:
						ddate = pyslurm.epoch2date(value[part_key])
						print("\t{0:<20} : {1}".format(part_key, ddate))
				else:
					print("\t{0:<20} : {1}".format(part_key, value[part_key]))
				
			print("-" * 80)
示例#10
0
def display(block_dict):
    """Format output"""
    if block_dict:

        date_fields = []

        print(f"{'':*^80}")

        for key, value in block_dict.items():

            print(f"{key} :")
            for part_key in sorted(value.items()):

                if part_key in date_fields:
                    ddate = value[part_key]
                    if ddate == 0:
                        print(f"\t{part_key:<17} : N/A")
                    elif ("reason_uid"
                          in part_key) and (value["reason"] is None):
                        print(f"\t{part_key:<17} :")
                    else:
                        ddate = pyslurm.epoch2date(ddate)
                        print(f"\t{part_key:<17} : {ddate}")
                elif part_key == "connection_type":
                    print(
                        f"\t{part_key:<17} : {pyslurm.get_connection_type(value[part_key])}"
                    )
                elif part_key == "state":
                    print(f"\t{part_key:<17} : {value[part_key]}")
                else:
                    print(f"\t{part_key:<17} : {value[part_key]}")

            print(f"{'':*^80}")
示例#11
0
def display(res_dict):

    if len(res_dict) > 0:

        date_fields = ['end_time', 'start_time']

        for key, value in res_dict.iteritems():

            print("{0} :".format(key))
            for res_key in sorted(value.iterkeys()):

                if res_key in date_fields:

                    if value[res_key] == 0:
                        print("\t{0:<20} : N/A".format(res_key))
                    else:
                        ddate = pyslurm.epoch2date(value[res_key])
                        print("\t{0:<20} : {1}".format(res_key, ddate))
                else:
                    print("\t{0:<20} : {1}".format(res_key, value[res_key]))

        print('{0:*^80}'.format(''))

        now = int(time.time())
        resvState = "INACTIVE"

        if value['start_time'] <= now and value['end_time'] >= now:
            resvState = "ACTIVE"

        print("\t%-20s : %s\n" % ("state", resvState))
示例#12
0
def display(res_dict):

    if len(res_dict) > 0:

        date_fields = ['end_time', 'start_time']

        for key, value in res_dict.iteritems():

            print("{0} :".format(key))
            for res_key in sorted(value.iterkeys()):

                if res_key in date_fields:

                    if value[res_key] == 0:
                        print("\t{0:<20} : N/A".format(res_key))
                    else:
                        ddate = pyslurm.epoch2date(value[res_key])
                        print("\t{0:<20} : {1}".format(res_key, ddate))
                else:
                        print("\t{0:<20} : {1}".format(res_key, value[res_key]))

        print('{0:*^80}'.format(''))

        now = int(time.time())
        resvState = "INACTIVE"

        if value['start_time'] <= now and value['end_time'] >= now:
            resvState = "ACTIVE"

        print("\t%-20s : %s\n" % ("state", resvState))
示例#13
0
def display(res_dict):
    """Format output"""
    if res_dict:

        date_fields = ["end_time", "start_time"]

        for key, value in res_dict.items():

            print("{0} :".format(key))
            for res_key in sorted(value.keys()):

                if res_key in date_fields:

                    if value[res_key] == 0:
                        print("\t{0:<20} : N/A".format(res_key))
                    else:
                        ddate = pyslurm.epoch2date(value[res_key])
                        print("\t{0:<20} : {1}".format(res_key, ddate))
                else:
                    print("\t{0:<20} : {1}".format(res_key, value[res_key]))

        print("{0:*^80}".format(""))

        now = int(time.time())
        resvState = "INACTIVE"

        if value["start_time"] <= now <= value["end_time"]:
            resvState = "ACTIVE"

        print("\t%-20s : %s\n" % ("state", resvState))
示例#14
0
文件: stats.py 项目: tazend/pyslurm
def display(stats_dict):
    """Format output"""
    if stats_dict:
        print(f"{' Slurm Controller Statistics ':*^80}")
        for key, value in stats_dict.items():
            if key in ["bf_when_last_cycle", "req_time", "req_time_start"]:
                ddate = value
                if ddate == 0:
                    print(f"{key:<25} : N/A")
                else:
                    ddate = pyslurm.epoch2date(ddate)
                    print(f"{key:<25} : {ddate:<17}")
            elif key in ["rpc_user_stats", "rpc_type_stats"]:
                label = "rpc_user_id"
                if key == "rpc_type_stats":
                    label = "rpc_type_id"
                print("{key:<25} :")
                for rpc_key, rpc_val in value.items():
                    print(f"\t{label:<12} : {rpc_key:<15}")
                    for rpc_val_key, rpc_value in rpc_val.items():
                        print(f"\t\t{rpc_val_key:<12} : {rpc_value:<15}")
            else:
                print(f"{key:<25} : {value:<17}")

        print("{'':*^80}")
    else:
        print("No Stats found !")
示例#15
0
def display(block_dict):
    """Format output"""
    if block_dict:

        date_fields = []

        print("{0:*^80}".format(""))

        for key, value in block_dict.items():

            print("{0} :".format(key))
            for part_key in sorted(value.items()):

                if part_key in date_fields:
                    ddate = value[part_key]
                    if ddate == 0:
                        print("\t{0:<17} : N/A".format(part_key))
                    elif ("reason_uid"
                          in part_key) and (value["reason"] is None):
                        print("\t{0:<17} :".format(part_key))
                    else:
                        ddate = pyslurm.epoch2date(ddate)
                        print("\t{0:<17} : {1}".format(part_key, ddate))
                elif part_key == "connection_type":
                    print("\t{0:<17} : {1}".format(
                        part_key,
                        pyslurm.get_connection_type(value[part_key])))
                elif part_key == "state":
                    print("\t{0:<17} : {1}".format(part_key, value[part_key]))
                else:
                    print("\t{0:<17} : {1}".format(part_key, value[part_key]))

            print("{0:*^80}".format(""))
示例#16
0
文件: stats.py 项目: wpoely86/pyslurm
def display(stats_dict):
    """Format output"""
    if stats_dict:
        print("{0:*^80}".format(" Slurm Controller Statistics "))
        for key, value in stats_dict.items():
            if key in ["bf_when_last_cycle", "req_time", "req_time_start"]:
                ddate = value
                if ddate == 0:
                    print("{0:<25} : N/A".format(key))
                else:
                    ddate = pyslurm.epoch2date(ddate)
                    print("{0:<25} : {1:<17}".format(key, ddate))
            elif key in ["rpc_user_stats", "rpc_type_stats"]:
                label = "rpc_user_id"
                if key == "rpc_type_stats":
                    label = "rpc_type_id"
                print("{0:<25} :".format(key))
                for rpc_key, rpc_val in value.items():
                    print("\t{0:<12} : {1:<15}".format(label, rpc_key))
                    for rpc_val_key, rpc_value in rpc_val.items():
                        print("\t\t{0:<12} : {1:<15}".format(
                            rpc_val_key, rpc_value))
            else:
                print("{0:<25} : {1:<17}".format(key, value))

        print("{0:*^80}".format(""))
    else:
        print("No Stats found !")
示例#17
0
def display(block_dict):

	if block_dict:

     
		date_fields = [ ]
      
		print "-" * 80
      
		for key, value in block_dict.iteritems():

			print "%s :" % (key)
			for part_key in sorted(value.iterkeys()):

				if part_key in date_fields:
					ddate = value[part_key]
					if ddate == 0:
						print "\t%-17s : N/A" % (part_key)
					elif ('reason_uid' in part_key) and (value['reason'] is None):
						print "\t%-17s :" % part_key
					else:
						ddate = pyslurm.epoch2date(ddate)
						print "\t%-17s : %s" % (part_key, ddate)
				elif part_key == 'connection_type':
					print "\t%-17s : %s" % (part_key, pyslurm.get_connection_type(value[part_key]))
				elif part_key == 'state':
					print "\t%-17s : %s" % (part_key, value[part_key])
				else: 
					print "\t%-17s : %s" % (part_key, value[part_key])

			print "-" * 80
示例#18
0
def display(job_dict):
    """Format output"""
    if job_dict:

        time_fields = ["time_limit"]

        date_fields = [
            "start_time",
            "submit_time",
            "end_time",
            "eligible_time",
            "resize_time",
        ]

        for key, value in sorted(job_dict.items()):

            print("JobID {0} :".format(key))
            for part_key in sorted(value.keys()):

                if part_key in time_fields:
                    print("\t{0:<20} : Infinite".format(part_key))
                    continue

                if part_key in date_fields:

                    if value[part_key] == 0:
                        print("\t{0:<20} : N/A".format(part_key))
                    else:
                        ddate = pyslurm.epoch2date(value[part_key])
                        print("\t{0:<20} : {1}".format(part_key, ddate))
                else:
                    print("\t{0:<20} : {1}".format(part_key, value[part_key]))

            print("-" * 80)
示例#19
0
def display(res_dict):

    if len(res_dict) > 0:

        date_fields = ['end_time', 'start_time']

        for key, value in res_dict.iteritems():

            for res_key in sorted(value.iterkeys()):

                if res_key in date_fields:

                    if value[res_key] == 0:
                        print "\t%-20s : N/A" % (res_key)
                    else:
                        ddate = pyslurm.epoch2date(value[res_key])
                        print "\t%-20s : %s" % (res_key, ddate)
                else:
                    print "\t%-20s : %s" % (res_key, value[res_key])

        print "-" * 80
示例#20
0
def display(res_dict):

	if len(res_dict) > 0:

		date_fields = ['end_time', 'start_time']

		for key, value in res_dict.iteritems():

			for res_key in sorted(value.iterkeys()):

				if res_key in date_fields:

					if value[res_key] == 0:
						print "\t%-20s : N/A" % (res_key)
					else:
						ddate = pyslurm.epoch2date(value[res_key])
						print "\t%-20s : %s" % (res_key, ddate)
				else:
						print "\t%-20s : %s" % (res_key, value[res_key])

		print "-" * 80
示例#21
0
def display(steps):
    """Format output"""
    date_fields = ["start_time"]

    for job, job_step in sorted(steps.items()):

        print(f"Job: {job}")
        for step, step_dict in job_step.items():

            print(f"\tStep: {step}")
            for task, value in sorted(step_dict.items()):

                if task in date_fields:

                    if value == 0:
                        print(f"\t\t{task:<20} : N/A")
                    else:
                        ddate = pyslurm.epoch2date(value)
                        print(f"\t\t{task:<20} : {ddate}")
                else:
                    print(f"\t\t{task:<20} : {value}")
示例#22
0
def display(steps):
    """Format output"""
    date_fields = ["start_time"]

    for job, job_step in sorted(steps.items()):

        print("Job: {0}".format(job))
        for step, step_dict in job_step.items():

            print("\tStep: {0}".format(step))
            for task, value in sorted(step_dict.items()):

                if task in date_fields:

                    if value == 0:
                        print("\t\t{0:<20} : N/A".format(task))
                    else:
                        ddate = pyslurm.epoch2date(value)
                        print("\t\t{0:<20} : {1}".format(task, ddate))
                else:
                    print("\t\t{0:<20} : {1}".format(task, value))
示例#23
0
def display(steps):

    time_fields = ['time_limit']
    date_fields = ['start_time']

    for job, job_step in sorted(steps.items()):

        print("Job: {0}".format(job))
        for step, step_dict in job_step.items():

            print("\tStep: {0}".format(step))
            for task, value in sorted(step_dict.items()):

                if task in date_fields:

                    if value == 0:
                        print("\t\t{0:<20} : N/A".format(task))
                    else:
                        ddate = pyslurm.epoch2date(value)
                        print("\t\t{0:<20} : {1}".format(task, ddate))
                else:
                    print("\t\t{0:<20} : {1}".format(task, value))
示例#24
0
def display(steps):

	time_fields = ['time_limit']
	date_fields = ['start_time']

	for job, job_step in sorted(steps.iteritems()):

		print "Job: %s" % job
		for step, step_dict in job_step.iteritems():

			print "\tStep: %s" % step
               		for task, value in sorted(step_dict.iteritems()):

				if task in date_fields:

					if value == 0:
						print "\t\t%-20s : N/A" % (task)
					else:
						ddate = pyslurm.epoch2date(value)
						print "\t\t%-20s : %s" % (task, ddate)
				else:
					print "\t\t%-20s : %s" % (task, value)
示例#25
0
import sys
from time import gmtime, strftime

steps = pyslurm.jobstep()
a = steps.get()

if a:
    for job, job_step in sorted(a.iteritems()):


        print("Job: {0}".format(job))
        for step, step_data in sorted(job_step.iteritems()):

            print("\tStep: {0}".format(step))
            for step_item, item_data in sorted(step_data.iteritems()):

                if 'start_time' in step_item:
                    ddate = pyslurm.epoch2date(item_data)
                    print("\t\t{0:<15} : {1}".format(step_item, ddate))
                else:
                    print("\t\t{0:<15} : {1}".format(step_item, item_data))

            layout = steps.layout(job, step)
            print("\t\tLayout:")
            for name, value in sorted(layout.iteritems()):
                print("\t\t\t{0:<15} : {1}".format(name, value))

    print('{0:*^80}'.format(''))
else:
    print("No jobsteps found !")
示例#26
0
#!/usr/bin/env python
"""
List steps jobs have gone through
"""

import pyslurm

steps = pyslurm.jobstep()
a = steps.get()

if a:
    for job, job_step in sorted(a.items()):
        print(f"Job: {job}")
        for step, step_data in sorted(job_step.items()):
            print(f"\tStep: {step}")
            for step_item, item_data in sorted(step_data.items()):
                if "start_time" in step_item:
                    ddate = pyslurm.epoch2date(item_data)
                    print(f"\t\t{step_item:<15} : {ddate}")
                else:
                    print(f"\t\t{step_item:<15} : {item_data}")
            layout = steps.layout(job, step)
            print("\t\tLayout:")
            for name, value in sorted(layout.items()):
                print(f"\t\t\t{name:<15} : {value}")

    print(f"{'':*^80}")
else:
    print("No jobsteps found !")
示例#27
0
    def unchanged(self):
        return set(o for o in self.intersect
                   if self.past_dict[o] == self.current_dict[o])


if __name__ == "__main__":

    interval = 2
    change = 0

    a = pyslurm.block()
    block_dict = a.get()
    lastUpdate = a.lastUpdate()

    print("Loaded Slurm block data at {0}".format(
        pyslurm.epoch2date(lastUpdate)))
    print("Waiting for updated data ... polling every {0} second".format(
        interval))

    sleep(0.5)

    while 1:

        new_dict = a.get()
        newUpdate = a.lastUpdate()
        if newUpdate > lastUpdate:

            lastUpdate = a.lastUpdate()
            print("Block data update time changed - {0}".format(
                pyslurm.epoch2date(lastUpdate)))
示例#28
0
        return self.set_past - self.intersect 
    def changed(self):
        return set(o for o in self.intersect if self.past_dict[o] != self.current_dict[o])
    def unchanged(self):
        return set(o for o in self.intersect if self.past_dict[o] == self.current_dict[o])

if __name__ == "__main__":

    interval = 2
    change = 0

    a = pyslurm.block()
    block_dict = a.get()
    lastUpdate = a.lastUpdate()

    print("Loaded Slurm block data at {0}".format(pyslurm.epoch2date(lastUpdate)))
    print("Waiting for updated data ... polling every {0} second".format(interval))

    sleep(0.5)

    while 1:

        new_dict = a.get()
        newUpdate = a.lastUpdate()
        if newUpdate > lastUpdate:

            lastUpdate = a.lastUpdate()
            print("Block data update time changed - {0}".format(pyslurm.epoch2date(lastUpdate)))

            b = DictDiffer(block_dict, new_dict)
            if b.changed():
示例#29
0
    ctl_dict = a.get()
except ValueError as e:
    print("Error - {0}".format(e.args[0]))
    sys.exit(-1)

# Process the sorted Slurm configuration dictionary

date_fields = ['boot_time', 'last_update']
for key in sorted(ctl_dict.items()):

    if key in date_fields:

        if ctl_dict[key] == 0:
            print("\t{0:<35} : N/A".format(key))
        else:
            ddate = pyslurm.epoch2date(ctl_dict[key])
            print("\t{0:<35} : {1}".format(key, ddate))

    elif 'debug_flags' in key:
        print("\t{0:<35s} : {1}".format(key[0],
                                        pyslurm.get_debug_flags(key[1])))
    else:
        if 'key_pairs' not in key:
            print("\t{0:<35} : {1}".format(key[0], key[1]))

if "key_pairs" in ctl_dict:

    print()
    print("Additional Information :")
    print("------------------------")
    print()
示例#30
0
    res_dict = a.get()
    if res_dict.has_key(resid):

        date_fields = ['end_time', 'start_time']

        value = res_dict[resid]
        print "Res ID : %s" % (resid)
        for res_key in sorted(value.iterkeys()):

            if res_key in date_fields:

                if value[res_key] == 0:
                    print "\t%-20s : N/A" % (res_key)
                else:
                    ddate = pyslurm.epoch2date(value[res_key])
                    print "\t%-20s : %s" % (res_key, ddate)
            else:
                print "\t%-20s : %s" % (res_key, value[res_key])

        print "-" * 80

    else:
        print "No reservation %s found !" % resid
        sys.exit(-1)

    print "\n"
    print "%s" % ' All Reservations '.center(80, '-')
    a.print_reservation_info_msg()
    print "-" * 80
示例#31
0
		return self.set_past - self.intersect 
	def changed(self):
		return set(o for o in self.intersect if self.past_dict[o] != self.current_dict[o])
	def unchanged(self):
		return set(o for o in self.intersect if self.past_dict[o] == self.current_dict[o])

if __name__ == "__main__":

	interval = 2
	change = 0

	a = pyslurm.block()
	block_dict = a.get()
	lastUpdate = a.lastUpdate()

	print "Loaded Slurm block data at %s" % pyslurm.epoch2date(lastUpdate)
	print "Waiting for updated data ... polling every %s second" % interval

	sleep(0.5)

	while 1:

		new_dict = a.get()
		newUpdate = a.lastUpdate()
		if newUpdate > lastUpdate:

			lastUpdate = a.lastUpdate()
			print "Block data update time changed - %s" % pyslurm.epoch2date(lastUpdate)

			b = DictDiffer(block_dict, new_dict)
			if b.changed():
示例#32
0
        """Check for no change"""
        return set(
            o for o in self.intersect if self.past_dict[o] == self.current_dict[o]
        )


if __name__ == "__main__":

    interval = 2
    change = 0

    a = pyslurm.block()
    block_dict = a.get()
    lastUpdate = a.lastUpdate()

    print("Loaded Slurm block data at {0}".format(pyslurm.epoch2date(lastUpdate)))
    print("Waiting for updated data ... polling every {0} second".format(interval))

    sleep(0.5)

    while True:
        new_dict = a.get()
        newUpdate = a.lastUpdate()
        if newUpdate > lastUpdate:

            lastUpdate = a.lastUpdate()
            print(
                "Block data update time changed - {0}".format(
                    pyslurm.epoch2date(lastUpdate)
                )
            )
示例#33
0
res_dict = a.get()
if res_dict.has_key(resid):

	date_fields = [ 'end_time', 'start_time' ]

	value = res_dict[resid]
	print "Res ID : %s" % (resid)
	for res_key in sorted(value.iterkeys()):

		if res_key in date_fields:

			if value[res_key] == 0:
				print "\t%-20s : N/A" % (res_key)
			else:
				ddate = pyslurm.epoch2date(value[res_key])
				print "\t%-20s : %s" % (res_key, ddate)
		else:
				print "\t%-20s : %s" % (res_key, value[res_key])

	print "-" * 80

else:
        print "No reservation %s found !" % resid
	sys.exit(-1)

print "\n"
print "%s" % ' All Reservations '.center(80, '-')
a.print_reservation_info_msg()
print "-" * 80
示例#34
0
import pyslurm

a = pyslurm.config()
ctl_dict = a.get()

# Process the sorted SLURM configuration dictionary

date_fields = [ 'boot_time', 'last_update' ]
for key in sorted(ctl_dict.iterkeys()):

	if key in date_fields:

		if ctl_dict[key] == 0:
			print "\t%-35s : N/A" % (key)
		else:
			ddate = pyslurm.epoch2date(ctl_dict[key])
			print "\t%-35s : %s" % (key, ddate)

	elif 'debug_flags' in key:
		print "\t%-35s : %s" % (key, pyslurm.get_debug_flags(ctl_dict[key]))
	else:
		if 'key_pairs' not in key:
			print "\t%-35s : %s" % (key, ctl_dict[key])

if ctl_dict.has_key('key_pairs'):

	print ""
	print "Additional Information :"
	print "------------------------"
	print ""