Exemplo n.º 1
0
def controller_up(controller=0):
    """Check if controller up via ping"""
    try:
        pyslurm.slurm_ping(controller)
    except ValueError as ping_error:
        print(f"Failed - {ping_error.args[0]}")
    else:
        print("Success")


if __name__ == "__main__":

    print()
    print(f"PySLURM\t\t{pyslurm.version()}")
    major, minor, micro = pyslurm.slurm_api_version()
    print(f"SLURM API\t{major}-{minor}-{micro}\n")

    host = socket.gethostname()
    print(f"Checking host.....{host}")

    try:
        a = pyslurm.is_controller(host)
        print(f"\tHost is controller ({a})\n")

        print("Querying SLURM controllers")
        control_machs = pyslurm.get_controllers()

        X = 0
        for machine in control_machs:
            if X == 0:
Exemplo n.º 2
0
import sys

def controller_up(controller=1):

	try:
		pyslurm.slurm_ping(controller)
	except valueError as e:
		print("Failed - {0}".format(e.args[0]))
	else:
		print("Success")

if __name__ == "__main__":

	print()
	print("PySLURM\t\t{0}".format(pyslurm.version()))
	print("SLURM API\t{0}-{1}-{2}\n".format(*pyslurm.slurm_api_version()))

	host = socket.gethostname()
	print("Checking host.....{0}".format(host))

	try:
		a = pyslurm.is_controller(host)
		print("\tHost is controller ({0})\n".format(a))

		print("Querying SLURM controllers")
		primary, backup = pyslurm.get_controllers()

		print("\tPrimary - {0}".format(primary))
		print("\tBackup  - {0}".format(backup))

		print("\nPinging SLURM controllers")
Exemplo n.º 3
0
def controller_up(controller=1):

    rc = pyslurm.slurm_ping(controller)
    if rc != 0:
        rc = pyslurm.slurm_get_errno()
        print "\t\tFailed - %s" % pyslurm.slurm_strerror(rc)
    else:
        print "\t\tSuccess"


if __name__ == "__main__":

    print "\n"
    print "PySLURM\t%s" % (pyslurm.version())
    print "SLURM\t%s-%s-%s\n" % (pyslurm.slurm_api_version())

    host = socket.gethostname()
    print "Checking host.....%s\n" % host

    a = pyslurm.is_controller(host)
    print "\tHost is controller (%s)\n" % a

    print "Querying SLURM controllers\n"
    primary, backup = pyslurm.get_controllers()

    print "\tPrimary - %s" % primary
    print "\tBackup  - %s" % backup

    print "\nPinging SLURM controllers\n"
Exemplo n.º 4
0
def test_slurm_api_version():
    """Misc: Test slurm_api_version()."""
    ver = pyslurm.slurm_api_version()
    assert_equals(ver[0], 17)
    assert_equals(ver[1], 11)
Exemplo n.º 5
0
def controller_up(controller=1):

	rc = pyslurm.slurm_ping(controller)
	if rc != 0:
		rc = pyslurm.slurm_get_errno()
		print "\t\tFailed - %s" % pyslurm.slurm_strerror(rc)
	else:
		print "\t\tSuccess"


if __name__ == "__main__":

	print "\n"
	print "PySLURM\t%s" % (pyslurm.version())
	print "SLURM\t%s-%s-%s\n" % (pyslurm.slurm_api_version())

	host = socket.gethostname()
	print "Checking host.....%s\n" % host

	a = pyslurm.is_controller(host)
	print "\tHost is controller (%s)\n" % a

	print "Querying SLURM controllers\n"
	primary, backup = pyslurm.get_controllers()

	print "\tPrimary - %s" % primary
	print "\tBackup  - %s" % backup

	print "\nPinging SLURM controllers\n"
Exemplo n.º 6
0
def test_slurm_api_version():
    """Misc: Test slurm_api_version()."""
    ver = pyslurm.slurm_api_version()
    assert ver[0] == 20
    assert ver[1] == 11
Exemplo n.º 7
0
def main():
    ver_report = open('/home/slurm/todo-api/logs/tmp', 'a')
    ver_report.write(str("PySLURM\t%s" % (pyslurm.version())) + '\n' + str("SLURM\t%s-%s-%s\n" % (pyslurm.slurm_api_version())))
    ver_report.close()