docstr: Create a run with a text summary, metadata, and optionally a
  graph.
docstr_tok: ["Create","a","run","with","a","text","summary",",","metadata",",","and","optionally","a","graph","."]
code: def generate_run(
      self, logdir, run_name, include_graph, include_run_metadata
  ):
      """Create a run with a text summary, metadata, and optionally a
      graph."""
      tf.compat.v1.reset_default_graph()
      k1 = tf.constant(math.pi, name="k1")
      k2 = tf.constant(math.e, name="k2")
      result = (k1**k2) - k1
      expected = tf.constant(20.0, name="expected")
      error = tf.abs(result - expected, name="error")
      message_prefix_value = "error " * 1000
      true_length = len(message_prefix_value)
      assert (
          true_length > self._MESSAGE_PREFIX_LENGTH_LOWER_BOUND
      ), true_length
      message_prefix = tf.constant(
          message_prefix_value, name="message_prefix"
      )
      error_message = tf.strings.join(
          [message_prefix, tf.as_string(error, name="error_string")],
          name="error_message",
      )
      summary_message = tf.compat.v1.summary.text(
          "summary_message", error_message
      )
  
      sess = tf.compat.v1.Session()
      writer = test_util.FileWriter(os.path.join(logdir, run_name))
      if include_graph:
          writer.add_graph(sess.graph)
      options = tf.compat.v1.RunOptions(
          trace_level=tf.compat.v1.RunOptions.FULL_TRACE
      )
      run_metadata = config_pb2.RunMetadata()
      s = sess.run(
          summary_message, options=options, run_metadata=run_metadata
      )
      writer.add_summary(s)
      if include_run_metadata:
          writer.add_run_metadata(run_metadata, self._METADATA_TAG)
      writer.close()
  
imports: import collections.abc
  import math
  import os.path
  import tensorflow
  from google.protobuf import text_format
  from tensorboard import context
  from tensorboard import errors
  from tensorboard.backend.event_processing import data_provider
  from tensorboard.backend.event_processing import plugin_event_multiplexer
  from tensorboard.compat.proto import config_pb2
  from tensorboard.plugins import base_plugin
  from tensorboard.plugins.graph import graphs_plugin
  from tensorboard.util import test_util
label_desc: Use image node_id 1 for calling the GraphsPluginV1Test obj's underlying member method code with example usage: obj.generate_run(logdir, run_name, include_graph, include_run_metadata) without return types