def _validate_pv_arguments()

in launcher/config_validator/value_validator.py [0:0]


def _validate_pv_arguments(config: DictConfig) -> None:
    """
    Check all the information needed for persistentVolumeClaim is provided if it is not None

    Parameters:
    config (DictConfig): Configuration dictionary
    """
    cluster_config_name = "cluster.cluster_config"
    cluster_config = get_argument(config, cluster_config_name)
    pv_argument_name = "persistentVolumeClaims"
    exception_message: str = "claimName and mountPath should be provided for persistentVolumeClaim"
    if cluster_config is not None and pv_argument_name in cluster_config:
        pv_arguments = cluster_config.get(pv_argument_name)
        claim_name = "claimName"
        mount_path = "mountPath"
        for pv_argument in pv_arguments:
            if pv_argument is None or claim_name not in pv_argument or mount_path not in pv_argument:
                raise ValueError(exception_message)
            claim_name_argument = pv_argument.get(claim_name)
            mount_path_argument = pv_argument.get(mount_path)
            if claim_name_argument is None or mount_path_argument is None:
                raise ValueError(exception_message)