Bug: Fix doctest for new version mlfow
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 18/Nov/22 02:20
Affects Version/s: 3.4.0


                                                                                
**********************************************************************
File "/__w/spark/spark/python/pyspark/pandas/mlflow.py", line 168, in pyspark.pandas.mlflow.load_model
Failed example:
    run_info = client.list_run_infos(exp_id)[-1]
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.9/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest pyspark.pandas.mlflow.load_model[14]>", line 1, in <module>
        run_info = client.list_run_infos(exp_id)[-1]
    AttributeError: 'MlflowClient' object has no attribute 'list_run_infos'
**********************************************************************
File "/__w/spark/spark/python/pyspark/pandas/mlflow.py", line 169, in pyspark.pandas.mlflow.load_model
Failed example:
    model = load_model("runs:/{run_id}/model".format(run_id=run_info.run_uuid))
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.9/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest pyspark.pandas.mlflow.load_model[15]>", line 1, in <module>
        model = load_model("runs:/{run_id}/model".format(run_id=run_info.run_uuid))
    NameError: name 'run_info' is not defined
**********************************************************************
File "/__w/spark/spark/python/pyspark/pandas/mlflow.py", line 171, in pyspark.pandas.mlflow.load_model
Failed example:
    prediction_df["prediction"] = model.predict(prediction_df)
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.9/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest pyspark.pandas.mlflow.load_model[17]>", line 1, in <module>
        prediction_df["prediction"] = model.predict(prediction_df)
    NameError: name 'model' is not defined
**********************************************************************
File "/__w/spark/spark/python/pyspark/pandas/mlflow.py", line 172, in pyspark.pandas.mlflow.load_model
Failed example:
    prediction_df
Expected:
        x1   x2  prediction
    0  2.0  4.0    1.355551
Got:
        x1   x2
    0  2.0  4.0
**********************************************************************
File "/__w/spark/spark/python/pyspark/pandas/mlflow.py", line 178, in pyspark.pandas.mlflow.load_model
Failed example:
    model.predict(prediction_df[["x1", "x2"]].to_pandas())
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.9/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest pyspark.pandas.mlflow.load_model[19]>", line 1, in <module>
        model.predict(prediction_df[["x1", "x2"]].to_pandas())
    NameError: name 'model' is not defined
**********************************************************************
File "/__w/spark/spark/python/pyspark/pandas/mlflow.py", line 189, in pyspark.pandas.mlflow.load_model
Failed example:
    y = model.predict(features)
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.9/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest pyspark.pandas.mlflow.load_model[22]>", line 1, in <module>
        y = model.predict(features)
    NameError: name 'model' is not defined
**********************************************************************
File "/__w/spark/spark/python/pyspark/pandas/mlflow.py", line 198, in pyspark.pandas.mlflow.load_model
Failed example:
    features['y'] = y
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.9/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest pyspark.pandas.mlflow.load_model[25]>", line 1, in <module>
        features['y'] = y
    NameError: name 'y' is not defined
**********************************************************************
File "/__w/spark/spark/python/pyspark/pandas/mlflow.py", line 200, in pyspark.pandas.mlflow.load_model
Failed example:
    everything
Expected:
        x1   x2  z         y
    0  2.0  3.0 -1  1.376932
Got:
        x1   x2  z
    0  2.0  3.0 -1
**********************************************************************
   8 of  26 in pyspark.pandas.mlflow.load_model