<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: workflow not pickingup correct host value (While working with MLflow model registry URI) in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/workflow-not-pickingup-correct-host-value-while-working-with/m-p/119109#M4075</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/163000"&gt;@Dharma25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error clearly shows that MLflow requests are being incorrectly routed to "canada.cloud.databricks.com" instead of your actual workspace URL, causing the timeout.&lt;BR /&gt;This is a known issue that can occur with MLflow in Databricks, particularly when working with Unity Catalog models. Here's a more targeted approach to fix it:&lt;/P&gt;&lt;P&gt;1. First, ensure your environment variables are correctly set before any MLflow operations:&lt;BR /&gt;import os&lt;BR /&gt;import mlflow&lt;/P&gt;&lt;P&gt;# Explicitly define the workspace URL (don't rely on environment variables that might not propagate)&lt;BR /&gt;workspace_url = "&lt;A href="https://your-actual-workspace-url.cloud.databricks.com" target="_blank"&gt;https://your-actual-workspace-url.cloud.databricks.com&lt;/A&gt;" # Replace with your actual URL&lt;/P&gt;&lt;P&gt;# Set both tracking and registry URIs explicitly&lt;BR /&gt;os.environ["DATABRICKS_HOST"] = workspace_url&lt;BR /&gt;mlflow.set_tracking_uri(workspace_url)&lt;BR /&gt;mlflow.set_registry_uri("databricks-uc")&lt;/P&gt;&lt;P&gt;2. When loading the model, you might need to be more explicit:&lt;BR /&gt;# Try with the full model URI format&lt;BR /&gt;model_uri = f"models://{model_name}/{model_version}"&lt;BR /&gt;model_udf = mlflow.pyfunc.spark_udf(spark, model_uri, env_manager="conda")&lt;/P&gt;&lt;P&gt;3. For Spark environments, also ensure the configuration is properly set:&lt;BR /&gt;spark.conf.set("spark.databricks.mlflow.trackingUri", workspace_url)&lt;/P&gt;&lt;P&gt;This issue is often related to how the MLflow client resolves endpoints when working with Unity Catalog,&lt;BR /&gt;where it sometimes falls back to a default domain instead of using the workspace-specific URL you've provided.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 May 2025 04:09:29 GMT</pubDate>
    <dc:creator>lingareddy_Alva</dc:creator>
    <dc:date>2025-05-14T04:09:29Z</dc:date>
    <item>
      <title>workflow not pickingup correct host value (While working with MLflow model registry URI)</title>
      <link>https://community.databricks.com/t5/machine-learning/workflow-not-pickingup-correct-host-value-while-working-with/m-p/117389#M4042</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Exception&lt;/STRONG&gt;&lt;/U&gt;: mlflow.exceptions.MlflowException: An API request to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://canada.cloud.databricks.com/api/2.0/mlflow/model-versions/list-artifacts" target="_blank" rel="noopener"&gt;https://canada.cloud.databricks.com/api/2.0/mlflow/model-versions/list-artifacts&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;failed due to a timeout. The error message was: HTTPSConnectionPool(host='canada.cloud.databricks.com', port=443): Max retries exceeded with url: /api/2.0/mlflow/model-versions/list-artifacts.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Expected&lt;/STRONG&gt;&lt;/U&gt;: The request should be directed to the current workspace URI instead of cloud.databricks.com.&lt;/P&gt;&lt;P&gt;I am encountering a strange issue while executing my code within a workflow. I am attempting to load an MLflow model registered in the Unity Catalog using mlflow.pyfunc.spark_udf(). I have ensured that the model URI and other parameters are correct. This code is part of a Python class.&lt;/P&gt;&lt;P&gt;Additionally, I am setting the registry URI using mlflow.set_registry_uri("databricks-uc"). Below are the environment variables I am configuring at the compute level:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATABRICKS_HOST&lt;/STRONG&gt;="&amp;lt;workspace_url&amp;gt;" &lt;STRONG&gt;DATABRICKS_TOKEN&lt;/STRONG&gt;="&amp;lt;PAT&amp;gt;"&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Spark configuration:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;spark.executorEnv.DATABRICKS_HOST&lt;/STRONG&gt;="&amp;lt;workspace_url&amp;gt;" &lt;STRONG&gt;spark.executorEnv.DATABRICKS_TOKEN&lt;/STRONG&gt;="&amp;lt;PAT&amp;gt;"&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Databricks runtime version&lt;/STRONG&gt;: 14.3&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 13:47:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/workflow-not-pickingup-correct-host-value-while-working-with/m-p/117389#M4042</guid>
      <dc:creator>Dharma25</dc:creator>
      <dc:date>2025-05-01T13:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: workflow not pickingup correct host value (While working with MLflow model registry URI)</title>
      <link>https://community.databricks.com/t5/machine-learning/workflow-not-pickingup-correct-host-value-while-working-with/m-p/119109#M4075</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/163000"&gt;@Dharma25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error clearly shows that MLflow requests are being incorrectly routed to "canada.cloud.databricks.com" instead of your actual workspace URL, causing the timeout.&lt;BR /&gt;This is a known issue that can occur with MLflow in Databricks, particularly when working with Unity Catalog models. Here's a more targeted approach to fix it:&lt;/P&gt;&lt;P&gt;1. First, ensure your environment variables are correctly set before any MLflow operations:&lt;BR /&gt;import os&lt;BR /&gt;import mlflow&lt;/P&gt;&lt;P&gt;# Explicitly define the workspace URL (don't rely on environment variables that might not propagate)&lt;BR /&gt;workspace_url = "&lt;A href="https://your-actual-workspace-url.cloud.databricks.com" target="_blank"&gt;https://your-actual-workspace-url.cloud.databricks.com&lt;/A&gt;" # Replace with your actual URL&lt;/P&gt;&lt;P&gt;# Set both tracking and registry URIs explicitly&lt;BR /&gt;os.environ["DATABRICKS_HOST"] = workspace_url&lt;BR /&gt;mlflow.set_tracking_uri(workspace_url)&lt;BR /&gt;mlflow.set_registry_uri("databricks-uc")&lt;/P&gt;&lt;P&gt;2. When loading the model, you might need to be more explicit:&lt;BR /&gt;# Try with the full model URI format&lt;BR /&gt;model_uri = f"models://{model_name}/{model_version}"&lt;BR /&gt;model_udf = mlflow.pyfunc.spark_udf(spark, model_uri, env_manager="conda")&lt;/P&gt;&lt;P&gt;3. For Spark environments, also ensure the configuration is properly set:&lt;BR /&gt;spark.conf.set("spark.databricks.mlflow.trackingUri", workspace_url)&lt;/P&gt;&lt;P&gt;This issue is often related to how the MLflow client resolves endpoints when working with Unity Catalog,&lt;BR /&gt;where it sometimes falls back to a default domain instead of using the workspace-specific URL you've provided.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 04:09:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/workflow-not-pickingup-correct-host-value-while-working-with/m-p/119109#M4075</guid>
      <dc:creator>lingareddy_Alva</dc:creator>
      <dc:date>2025-05-14T04:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: workflow not pickingup correct host value (While working with MLflow model registry URI)</title>
      <link>https://community.databricks.com/t5/machine-learning/workflow-not-pickingup-correct-host-value-while-working-with/m-p/119473#M4081</link>
      <description>&lt;P&gt;Thanks for the answer. I will try this solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 13:33:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/workflow-not-pickingup-correct-host-value-while-working-with/m-p/119473#M4081</guid>
      <dc:creator>Dharma25</dc:creator>
      <dc:date>2025-05-16T13:33:47Z</dc:date>
    </item>
  </channel>
</rss>

