def _validate_volume_arguments()

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


def _validate_volume_arguments(config: DictConfig) -> None:
    """
    Check all the information needed for volume 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)
    volumes_argument_name = "volumes"
    exception_message: str = "hostPath, mountPath, volumeName should be provided for volumes"
    if cluster_config is not None and volumes_argument_name in cluster_config:
        volume_arguments = cluster_config.get(volumes_argument_name)
        if volume_arguments is None:
            return
        host_path = "hostPath"
        mount_path = "mountPath"
        volume_name = "volumeName"
        print(volume_arguments)
        for volume_argument in volume_arguments:
            if (
                volume_argument is None
                or host_path not in volume_argument
                or mount_path not in volume_argument
                or volume_name not in volume_argument
            ):
                raise ValueError(exception_message)
            host_path_argument = volume_argument.get(host_path)
            mount_path_argument = volume_argument.get(mount_path)
            volume_name_argument = volume_argument.get(volume_name)
            if host_path_argument is None or mount_path_argument is None or volume_name_argument is None:
                raise ValueError(exception_message)