aztk/node_scripts/install/pick_master.py
def find_master(client: batch.BatchServiceClient) -> bool:
    """
        Try to set a master for the cluster. If the node is dedicated it will try to assign itself if none already claimed it.
        :returns bool: If the node is the master it returns true otherwise returns false
    """
    # If not dedicated the node cannot be a master
    # TODO enable when inter node communication is working with low pri and dedicated together.
    # if not config.is_dedicated:
    # return False

    for i in range(0, 5):
        pool = client.pool.get(config.pool_id)
        master = get_master_node_id(pool)

        if master:
            if master == config.node_id:
                print("Node is already the master '{0}'".format(master))
                return True
            else:
                print("Pool already has a master '{0}'. This node will be a worker".format(master))
                return False
        else:
            print("Pool has no master. Trying to assign itself! ({0}/5)".format(i + 1))
            result = try_assign_self_as_master(client, pool)

            if result:
                print("Assignment was successful! Node {0} is the new master.".format(config.node_id))
                return True

    raise CannotAllocateMasterError("Unable to assign node as a master in 5 tries")

        Try to set a master for the cluster. If the node is dedicated it will try to assign itself if none already claimed it.
        :returns bool: If the node is the master it returns true otherwise returns false
    
Try to set a master for the cluster. If the node is dedicated it will try to assign itself if none already claimed it.
Try to set a master for the cluster . If the node is dedicated it will try to assign itself if none already claimed it .
def find_master(client: batch.BatchServiceClient) -> bool:
    for i in range(0, 5):
        pool = client.pool.get(config.pool_id)
        master = get_master_node_id(pool)
        if master:
            if master == config.node_id:
                print("Node is already the master '{0}'".format(master))
                return True
            else:
                print("Pool already has a master '{0}'. This node will be a worker".format(master))
                return False
        else:
            print("Pool has no master. Trying to assign itself! ({0}/5)".format(i + 1))
            result = try_assign_self_as_master(client, pool)
            if result:
                print("Assignment was successful! Node {0} is the new master.".format(config.node_id))
                return True
    raise CannotAllocateMasterError("Unable to assign node as a master in 5 tries")
def find_master ( client : batch . BatchServiceClient ) -> bool : for i in range ( 0 , 5 ) : pool = client . pool . get ( config . pool_id ) master = get_master_node_id ( pool ) if master : if master == config . node_id : print ( "Node is already the master '{0}'" . format ( master ) ) return True else : print ( "Pool already has a master '{0}'. This node will be a worker" . format ( master ) ) return False else : print ( "Pool has no master. Trying to assign itself! ({0}/5)" . format ( i + 1 ) ) result = try_assign_self_as_master ( client , pool ) if result : print ( "Assignment was successful! Node {0} is the new master." . format ( config . node_id ) ) return True raise CannotAllocateMasterError ( "Unable to assign node as a master in 5 tries" )
Try to set a master for the cluster.
Try to set a master for the cluster .
"""
        Try to set a master for the cluster. If the node is dedicated it will try to assign itself if none already claimed it.
        :returns bool: If the node is the master it returns true otherwise returns false
    """ # If not dedicated the node cannot be a master # TODO enable when inter node communication is working with low pri and dedicated together. # if not config.is_dedicated: # return False
If the node is the master it returns true otherwise returns false
If the node is the master it returns true otherwise returns false
bool
client
batch.BatchServiceClient