def get_model_dir():
  """Returns model directory specified in either FLAGS or TF_CONFIG."""
  model_dir = None
  if FLAGS.model_dir:
    model_dir = FLAGS.model_dir
  elif os.getenv("TF_CONFIG"):
    tf_config = json.loads(os.getenv("TF_CONFIG"))
    model_dir = tf_config.get("model_dir")
  if not model_dir:
    tmp_dir = os.path.join(get_tempdir(), "adhoc_models")
    model_dir = os.path.join(tmp_dir, uuid.uuid4().hex)

  return model_dir
Returns model directory specified in either FLAGS or TF_CONFIG.
language/capwap/utils/experiment_utils.py