def verify_and_load_yaml()

in src/hyperpod_cli/validators/job_validator.py [0:0]


def verify_and_load_yaml(file_path: str):
    if not os.path.exists(file_path):
        logger.error(f"Configuration file {file_path} does not exist.")
        return None
    try:
        with open(file_path, "r") as file:
            # Attempt to load the YAML file
            data = yaml.load(file, Loader=SafeLoader)
            return data
    except Exception as e:
        logger.error(
            f"The config file {file_path} is not a valid YAML file. Error: {e}"
        )
        return None