code: def test_mlflow_args():
      """verifies that we generate the dynamic args for the caliban launcher
      script for mlflow integration"""
  
      # test case when caliban_config has no mlflow configuration
      cfg = {
          "caliban_config": {"base_image": "gcr.io/a/b"},
          "experiment_name": "foo",
          "index": 42,
          "tags": {"a": "x", "b": 7},
      }
  
      mlflow_args = um.mlflow_args(**cfg)
      assert len(mlflow_args) == 0
  
      # test case when caliban_config has empty mlflow configuration
      cfg = {
          "caliban_config": {
              "base_image": "gcr.io/a/b",
              "mlflow_config": None,
          },
          "experiment_name": "foo",
          "index": 42,
          "tags": {"a": "x", "b": 7},
      }
  
      mlflow_args = um.mlflow_args(**cfg)
      assert len(mlflow_args) == 0
  
      # test case when caliban_config has mlflow configuration
      cfg = {
          "caliban_config": {"mlflow_config": {}},
          "experiment_name": "foo",
          "index": 42,
          "tags": {"a": "x", "b": 7},
      }
  
      mlflow_args = um.mlflow_args(**cfg)
  
      assert len(mlflow_args) == 2
      assert mlflow_args[0] == "--caliban_config"
  
      # make sure that config is json dict
      arg_dict = json.loads(mlflow_args[1])
      assert isinstance(arg_dict, dict)
  
      assert "env" in arg_dict
      env_vars = arg_dict["env"]
      assert "MLFLOW_EXPERIMENT_NAME" in env_vars
      assert (
          env_vars["MLFLOW_EXPERIMENT_NAME"] == cfg["experiment_name"]
      )
  
      assert "MLFLOW_RUN_NAME" in env_vars
      assert isinstance(env_vars["MLFLOW_RUN_NAME"], str)
  
      for k, v in cfg["tags"].items():
          k_e = f"ENVVAR_{k}"
          assert k_e in env_vars
          assert env_vars[k_e] == v
  
file_path: caliban/tests/caliban/util/test_metrics.py
imports: import json
  import os
  import tempfile
  import caliban.util
  import caliban.util.metrics
label_desc: Use image node_id 3 for calling a global function with example usage: test_mlflow_args() without return types