def load_yaml_local()

in spark-on-eks/source/lib/util/manifest_reader.py [0:0]


def load_yaml_local(yaml_file, multi_resource=False):

    file_to_parse=path.join(path.dirname(__file__), yaml_file)
    if not path.exists(file_to_parse):
        print("The file {} does not exist"
            "".format(file_to_parse))
        sys.exit(1)

    try:
        with open(file_to_parse, 'r') as yaml_stream:
            if multi_resource:
                yaml_data = list(yaml.full_load_all(yaml_stream))
            else:
                yaml_data = yaml.full_load(yaml_stream) 
            # print(yaml_data)    
    except:
        print("Cannot read yaml config file {}, check formatting."
                "".format(file_to_parse))
        sys.exit(1)
        
    return yaml_data