def test_dev_version_pyspark_is_supported_in_databricks(flavor, module_version, expected_result): module_name, _ = FLAVOR_TO_MODULE_NAME_AND_VERSION_INFO_KEY[flavor] with mock.patch(module_name + ".__version__", module_version): # In Databricks with mock.patch( "mlflow.utils.autologging_utils.versioning.is_in_databricks_runtime", return_value=True, ) as mock_runtime: assert is_flavor_supported_for_associated_package_versions(flavor) == expected_result mock_runtime.assert_called() # Not in Databricks assert is_flavor_supported_for_associated_package_versions(flavor) is False
def autologging_is_disabled(integration_name): """ Returns a boolean flag of whether the autologging integration is disabled. :param integration_name: An autologging integration flavor name. """ explicit_disabled = get_autologging_config(integration_name, "disable", True) if explicit_disabled: return True if ( integration_name in FLAVOR_TO_MODULE_NAME_AND_VERSION_INFO_KEY and not is_flavor_supported_for_associated_package_versions(integration_name) ): return get_autologging_config(integration_name, "disable_for_unsupported_versions", False) return False
def _check_and_log_warning_for_unsupported_package_versions(integration_name): """ When autologging is enabled and `disable_for_unsupported_versions=False` for the specified autologging integration, check whether the currently-installed versions of the integration's associated package versions are supported by the specified integration. If the package versions are not supported, log a warning message. """ if (integration_name in FLAVOR_TO_MODULE_NAME_AND_VERSION_INFO_KEY and not get_autologging_config(integration_name, "disable", True) and not get_autologging_config( integration_name, "disable_for_unsupported_versions", False) and not is_flavor_supported_for_associated_package_versions( integration_name)): _logger.warning( "You are using an unsupported version of %s. If you encounter errors during " "autologging, try upgrading / downgrading %s to a supported version, or try " "upgrading MLflow.", integration_name, integration_name, )
def test_is_autologging_integration_supported(flavor, module_version, expected_result): module_name, _ = FLAVOR_TO_MODULE_NAME_AND_VERSION_INFO_KEY[flavor] with mock.patch(module_name + ".__version__", module_version): assert expected_result == is_flavor_supported_for_associated_package_versions(flavor)