code: def log_model(
      spark_model,
      sample_input,
      artifact_path,
      registered_model_name=None,
      signature: ModelSignature = None,
      input_example: ModelInputExample = None,
      metadata=None,
  ):
      """
      Log a Spark MLLib model in MLeap format as an MLflow artifact
      for the current run. The logged model will have the MLeap flavor.
  
      NOTE:
  
          You cannot load the MLeap model flavor in Python; you must download it using the
          Java API method ``downloadArtifacts(String runId)`` and load the model
          using the method ``MLeapLoader.loadPipeline(String modelRootPath)``.
  
      :param spark_model: Spark PipelineModel to be saved. This model must be MLeap-compatible and
                          cannot contain any custom transformers.
      :param sample_input: Sample PySpark DataFrame input that the model can evaluate. This is
                           required by MLeap for data schema inference.
      :param artifact_path: Run-relative artifact path.
      :param registered_model_name: If given, create a model version under
                                    ``registered_model_name``, also creating a registered model if one
                                    with the given name does not exist.
  
      :param signature: :py:class:`ModelSignature <mlflow.models.ModelSignature>`
                        describes model input and output :py:class:`Schema <mlflow.types.Schema>`.
                        The model signature can be :py:func:`inferred <mlflow.models.infer_signature>`
                        from datasets with valid model input (e.g. the training dataset with target
                        column omitted) and valid model output (e.g. model predictions generated on
                        the training dataset), for example:
  
                        .. code-block:: python
  
                          from mlflow.models import infer_signature
  
                          train = df.drop_column("target_label")
                          predictions = ...  # compute model predictions
                          signature = infer_signature(train, predictions)
      :param input_example: {{ input_example }}
      :param metadata: Custom metadata dictionary passed to the model and stored in the MLmodel file.
  
                       .. Note:: Experimental: This parameter may change or be removed in a future
                                               release without warning.
  
      :return: A :py:class:`ModelInfo <mlflow.models.model.ModelInfo>` instance that contains the
               metadata of the logged model.
  
  
      .. code-block:: python
          :caption: Example
  
          import mlflow
          import mlflow.mleap
          import pyspark
          from pyspark.ml import Pipeline
          from pyspark.ml.classification import LogisticRegression
          from pyspark.ml.feature import HashingTF, Tokenizer
  
          # training DataFrame
          training = spark.createDataFrame(
              [
                  (0, "a b c d e spark", 1.0),
                  (1, "b d", 0.0),
                  (2, "spark f g h", 1.0),
                  (3, "hadoop mapreduce", 0.0),
              ],
              ["id", "text", "label"],
          )
          # testing DataFrame
          test_df = spark.createDataFrame(
              [(4, "spark i j k"), (5, "l m n"), (6, "spark hadoop spark"), (7, "apache hadoop")],
              ["id", "text"],
          )
          # Create an MLlib pipeline
          tokenizer = Tokenizer(inputCol="text", outputCol="words")
          hashingTF = HashingTF(inputCol=tokenizer.getOutputCol(), outputCol="features")
          lr = LogisticRegression(maxIter=10, regParam=0.001)
          pipeline = Pipeline(stages=[tokenizer, hashingTF, lr])
          model = pipeline.fit(training)
          # log parameters
          mlflow.log_param("max_iter", 10)
          mlflow.log_param("reg_param", 0.001)
          # log the Spark MLlib model in MLeap format
          mlflow.mleap.log_model(
              spark_model=model, sample_input=test_df, artifact_path="mleap-model"
          )
      """
      return Model.log(
          artifact_path=artifact_path,
          flavor=mlflow.mleap,
          spark_model=spark_model,
          sample_input=sample_input,
          registered_model_name=registered_model_name,
          signature=signature,
          input_example=input_example,
          metadata=metadata,
      )
  
file_path: mlflow/mlflow/mleap/__init__.py
imports: import logging
  import os
  import pathlib
  import sys
  import traceback
  import mlflow
  from mlflow.exceptions import MlflowException
  from mlflow.models import Model, ModelInputExample, ModelSignature
  from mlflow.models.model import MLMODEL_FILE_NAME
  from mlflow.models.utils import _save_example
  from mlflow.utils import reraise
  from mlflow.utils.annotations import deprecated, keyword_only
  from mlflow.utils.file_utils import path_to_local_file_uri
label_desc: Use image node_id 1 for calling a global function with example usage: log_model(spark_model, sample_input, artifact_path, registered_model_name, signature, input_example, metadata) and returns: Model