code: def test_mlflow(tmpdir, external_run):
      epochs = 2
      batch_size = 8
      num_examples = 32
  
      input_features = [sequence_feature(reduce_output="sum")]
      output_features = [
          category_feature(
              vocab_size=2, reduce_input="sum", output_feature=True
          )
      ]
  
      config = {
          "input_features": input_features,
          "output_features": output_features,
          "combiner": {"type": "concat", "output_size": 14},
          TRAINER: {"epochs": epochs, "batch_size": batch_size},
      }
  
      data_csv = generate_data(
          input_features,
          output_features,
          os.path.join(tmpdir, "train.csv"),
          num_examples=num_examples,
      )
      val_csv = shutil.copyfile(
          data_csv, os.path.join(tmpdir, "validation.csv")
      )
      test_csv = shutil.copyfile(
          data_csv, os.path.join(tmpdir, "test.csv")
      )
  
      mlflow_uri = f"file://{tmpdir}/mlruns"
      mlflow.set_tracking_uri(mlflow_uri)
      client = MlflowClient(tracking_uri=mlflow_uri)
  
      exp_name = None
      run = None
      if external_run:
          # Start a run here and make sure it's still active when training completes
          exp_name = f"ext_experiment_{uuid.uuid4().hex}"
          exp_id = mlflow.create_experiment(name=exp_name)
          run = mlflow.start_run(
              experiment_id=exp_id,
              run_name=f"ext_run_{uuid.uuid4().hex}",
          )
  
      callback_run = run_mlflow_callback_test(
          client,
          config,
          data_csv,
          val_csv,
          test_csv,
          tmpdir,
          exp_name=exp_name,
      )
  
      if not external_run:
          run_mlflow_callback_test_without_artifacts(
              client, config, data_csv, val_csv, test_csv
          )
      else:
          assert run.info.run_id == callback_run.info.run_id
  
          active_run = mlflow.active_run()
          assert active_run is not None
          assert run.info.run_id == active_run.info.run_id
  
          mlflow.end_run()
  
imports: import os
  import shutil
  import uuid
  from unittest import mock
  import mlflow
  import pandas
  import pytest
  import yaml
  from mlflow.tracking import MlflowClient
  from ludwig.api import LudwigModel
  from ludwig.constants import TRAINER
  from ludwig.contribs.mlflow import MlflowCallback
  from ludwig.export import export_mlflow
  from ludwig.utils.backward_compatibility import upgrade_config_dict_to_latest_version
  from tests.integration_tests.utils import category_feature, FakeRemoteBackend, generate_data, sequence_feature
label_desc: Use image node_id 3 for calling a global function with example usage: test_mlflow(tmpdir, external_run) without return types