def get_trainer_rank():
    """Get the rank of the current trainer process.

    This function can only be called in the trainer process. It will result in
    an error if it's called in the process of other roles.
    """
    assert CUR_ROLE == "default"
    if IS_STANDALONE:
        return 0
    else:
        return PER_ROLE_RANK["default"][rpc.get_rank()]
Get the rank of the current trainer process.

    This function can only be called in the trainer process. It will result in
    an error if it's called in the process of other roles.
    
python/dgl/distributed/role.py