Beispiel #1
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(''))
Beispiel #2
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(''))
Beispiel #3
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
Beispiel #4
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
Beispiel #5
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(""))