<?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: Error executing mlflow's mlflow.register_model() in applyInPandas to register Model to another workspace. in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/error-executing-mlflow-s-mlflow-register-model-in-applyinpandas/m-p/17493#M939</link>
    <description>&lt;P&gt;@vaibhavsingal11​&amp;nbsp;, Hey, any progress on this? I'm facing the same issue, and It looks like dbutils is inaccessible from worker nodes: &lt;A href="https://github.com/mlflow/mlflow/blob/master/mlflow/utils/databricks_utils.py" alt="https://github.com/mlflow/mlflow/blob/master/mlflow/utils/databricks_utils.py" target="_blank"&gt;&lt;B&gt;LINK&lt;/B&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2467i85EA42CC8FAB6E23/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Mar 2022 11:53:16 GMT</pubDate>
    <dc:creator>Amardeep</dc:creator>
    <dc:date>2022-03-04T11:53:16Z</dc:date>
    <item>
      <title>Error executing mlflow's mlflow.register_model() in applyInPandas to register Model to another workspace.</title>
      <link>https://community.databricks.com/t5/machine-learning/error-executing-mlflow-s-mlflow-register-model-in-applyinpandas/m-p/17492#M938</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I am getting the following error (mlflow.utils.databricks_utils._NoDbutilsError) while trying to register model using applyInPandas to another databricks workspace. &lt;/P&gt;&lt;P&gt;I have already set the secret scope and prefix to authenticate against the 2nd azure databricks workspace where the models need to be registered and passing the remote URI in  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;mlflow.set_registry_uri('databricks://prod-mlflowreg:prodwss')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If I do it without using applyInPandas, it works. But not with applyInPandas.&lt;/P&gt;&lt;P&gt;Is it that mlflow doesn't work when executed in a worker node, inside a UDF. It looks like mlflow is not able to grab the host credentials for 2nd workspace. (get_databricks_host_creds in error)&lt;/P&gt;&lt;P&gt;Can you please take a look into this. Thanks.&lt;/P&gt;&lt;P&gt;def register_models(row):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;row.reset_index(drop=True, inplace=True)
 mlflow.set_registry_uri('databricks://prod-mlflowreg:prodwss')
 mlflow.register_model("runs:/" + row['run_id'][0] + "/model", row['run_id'][0])
 return pd.DataFrame(columns = ['null'])&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt; Defining schema of the resulting dataframe:&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;esult_schema = StructType( [StructField('null', StringType())] )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt; Register the models to the Mlflow registry&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;f_reg = sdf.groupBy("run_id") \ .applyInPandas(lambda df: register_models(df), result_schema)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------- PythonException Traceback (most recent call last) &amp;lt;command-1616661595521875&amp;gt; in &amp;lt;module&amp;gt; 1 # Triggering action ----&amp;gt; 2 df_reg.count()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/databricks/spark/python/pyspark/sql/&lt;A href="http://dataframe.py" alt="http://dataframe.py" target="_blank"&gt;dataframe.py&lt;/A&gt; in count(self) 584 2 585 """ --&amp;gt; 586 return int(self._jdf.count()) 587 588 @ignore_unicode_prefix&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/databricks/spark/python/lib/py4j-0.10.9-src.zip/py4j/java_gateway.py in &lt;B&gt;call&lt;/B&gt;(self, *args) 1303 answer = self.gateway_client.send_command(command) 1304 return_value = get_return_value( -&amp;gt; 1305 answer, self.gateway_client, self.target_id, &lt;A href="http://self.name" alt="http://self.name" target="_blank"&gt;self.name&lt;/A&gt;) 1306 1307 for temp_arg in temp_args:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/databricks/spark/python/pyspark/sql/&lt;A href="http://utils.py" alt="http://utils.py" target="_blank"&gt;utils.py&lt;/A&gt; in deco(&lt;I&gt;a, &lt;/I&gt;*kw) 131 # Hide where the exception came from that shows a non-Pythonic 132 # JVM exception message. --&amp;gt; 133 raise_from(converted) 134 else: 135 raise&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/databricks/spark/python/pyspark/sql/&lt;A href="http://utils.py" alt="http://utils.py" target="_blank"&gt;utils.py&lt;/A&gt; in raise_from(e)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PythonException: An exception was thrown from a UDF: 'mlflow.utils.databricks_utils._NoDbutilsError', from &amp;lt;command-1616661595521870&amp;gt;, line 18. Full traceback below: Traceback (most recent call last): File "/databricks/spark/python/pyspark/&lt;A href="http://worker.py" alt="http://worker.py" target="_blank"&gt;worker.py&lt;/A&gt;", line 654, in main process() File "/databricks/spark/python/pyspark/&lt;A href="http://worker.py" alt="http://worker.py" target="_blank"&gt;worker.py&lt;/A&gt;", line 646, in process serializer.dump_stream(out_iter, outfile) File "/databricks/spark/python/pyspark/sql/pandas/&lt;A href="http://serializers.py" alt="http://serializers.py" target="_blank"&gt;serializers.py&lt;/A&gt;", line 281, in dump_stream timely_flush_timeout_ms=self.timely_flush_timeout_ms) File "/databricks/spark/python/pyspark/sql/pandas/&lt;A href="http://serializers.py" alt="http://serializers.py" target="_blank"&gt;serializers.py&lt;/A&gt;", line 97, in dump_stream for batch in iterator: File "/databricks/spark/python/pyspark/sql/pandas/&lt;A href="http://serializers.py" alt="http://serializers.py" target="_blank"&gt;serializers.py&lt;/A&gt;", line 271, in init_stream_yield_batches for series in iterator: File "/databricks/spark/python/pyspark/&lt;A href="http://worker.py" alt="http://worker.py" target="_blank"&gt;worker.py&lt;/A&gt;", line 446, in mapper return f(keys, vals) File "/databricks/spark/python/pyspark/&lt;A href="http://worker.py" alt="http://worker.py" target="_blank"&gt;worker.py&lt;/A&gt;", line 176, in &amp;lt;lambda&amp;gt; return lambda k, v: [(wrapped(k, v), to_arrow_type(return_type))] File "/databricks/spark/python/pyspark/&lt;A href="http://worker.py" alt="http://worker.py" target="_blank"&gt;worker.py&lt;/A&gt;", line 161, in wrapped result = f(pd.concat(value_series, axis=1)) File "/databricks/spark/python/pyspark/&lt;A href="http://util.py" alt="http://util.py" target="_blank"&gt;util.py&lt;/A&gt;", line 109, in wrapper return f(&lt;I&gt;args, &lt;/I&gt;*kwargs) File "&amp;lt;command-1616661595521874&amp;gt;", line 8, in &amp;lt;lambda&amp;gt; File "&amp;lt;command-1616661595521870&amp;gt;", line 18, in register_models File "/databricks/python/lib/python3.7/site-packages/mlflow/tracking/_model_registry/&lt;A href="http://fluent.py" alt="http://fluent.py" target="_blank"&gt;fluent.py&lt;/A&gt;", line 27, in register_model create_model_response = client.create_registered_model(name) File "/databricks/python/lib/python3.7/site-packages/mlflow/tracking/&lt;A href="http://client.py" alt="http://client.py" target="_blank"&gt;client.py&lt;/A&gt;", line 395, in create_registered_model return self._get_registry_client().create_registered_model(name, tags, description) File "/databricks/python/lib/python3.7/site-packages/mlflow/tracking/_model_registry/&lt;A href="http://client.py" alt="http://client.py" target="_blank"&gt;client.py&lt;/A&gt;", line 47, in create_registered_model return self.store.create_registered_model(name, tags, description) File "/databricks/python/lib/python3.7/site-packages/mlflow/store/model_registry/rest_store.py", line 74, in create_registered_model response_proto = self._call_endpoint(CreateRegisteredModel, req_body) File "/databricks/python/lib/python3.7/site-packages/mlflow/store/model_registry/rest_store.py", line 55, in _call_endpoint return call_endpoint(self.get_host_creds(), endpoint, method, json_body, response_proto) File "/databricks/python/lib/python3.7/site-packages/mlflow/tracking/_model_registry/&lt;A href="http://utils.py" alt="http://utils.py" target="_blank"&gt;utils.py&lt;/A&gt;", line 94, in &amp;lt;lambda&amp;gt; return RestStore(lambda: get_databricks_host_creds(store_uri)) File "/databricks/python/lib/python3.7/site-packages/mlflow/utils/databricks_utils.py", line 216, in get_databricks_host_creds dbutils = _get_dbutils() File "/databricks/python/lib/python3.7/site-packages/mlflow/utils/databricks_utils.py", line 21, in _get_dbutils raise _NoDbutilsError mlflow.utils.databricks_utils._NoDbutilsError &lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 11:20:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/error-executing-mlflow-s-mlflow-register-model-in-applyinpandas/m-p/17492#M938</guid>
      <dc:creator>vaibhavsingal11</dc:creator>
      <dc:date>2021-07-21T11:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Error executing mlflow's mlflow.register_model() in applyInPandas to register Model to another workspace.</title>
      <link>https://community.databricks.com/t5/machine-learning/error-executing-mlflow-s-mlflow-register-model-in-applyinpandas/m-p/17493#M939</link>
      <description>&lt;P&gt;@vaibhavsingal11​&amp;nbsp;, Hey, any progress on this? I'm facing the same issue, and It looks like dbutils is inaccessible from worker nodes: &lt;A href="https://github.com/mlflow/mlflow/blob/master/mlflow/utils/databricks_utils.py" alt="https://github.com/mlflow/mlflow/blob/master/mlflow/utils/databricks_utils.py" target="_blank"&gt;&lt;B&gt;LINK&lt;/B&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2467i85EA42CC8FAB6E23/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 11:53:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/error-executing-mlflow-s-mlflow-register-model-in-applyinpandas/m-p/17493#M939</guid>
      <dc:creator>Amardeep</dc:creator>
      <dc:date>2022-03-04T11:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error executing mlflow's mlflow.register_model() in applyInPandas to register Model to another workspace.</title>
      <link>https://community.databricks.com/t5/machine-learning/error-executing-mlflow-s-mlflow-register-model-in-applyinpandas/m-p/17494#M940</link>
      <description>&lt;P&gt;yes- dbutils is only available on the driver.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 16:45:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/error-executing-mlflow-s-mlflow-register-model-in-applyinpandas/m-p/17494#M940</guid>
      <dc:creator>Dan_Z</dc:creator>
      <dc:date>2022-05-04T16:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Error executing mlflow's mlflow.register_model() in applyInPandas to register Model to another workspace.</title>
      <link>https://community.databricks.com/t5/machine-learning/error-executing-mlflow-s-mlflow-register-model-in-applyinpandas/m-p/17495#M941</link>
      <description>&lt;P&gt;Hi @vaibhavsingal11​&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a friendly follow-up. Do you still need help or Dan's response helped you to solved your question? &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 16:37:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/error-executing-mlflow-s-mlflow-register-model-in-applyinpandas/m-p/17495#M941</guid>
      <dc:creator>jose_gonzalez</dc:creator>
      <dc:date>2022-06-07T16:37:48Z</dc:date>
    </item>
  </channel>
</rss>

