code: def testPublishFailedExecution(self):
      with metadata.Metadata(
          connection_config=self._connection_config
      ) as m:
          executor_output = text_format.Parse(
              """
          execution_result {
            code: 1
            result_message: 'error message.'
           }
        """,
              execution_result_pb2.ExecutorOutput(),
          )
          contexts = self._generate_contexts(m)
          execution_id = execution_publish_utils.register_execution(
              m, self._execution_type, contexts
          ).id
          execution_publish_utils.publish_failed_execution(
              m, contexts, execution_id, executor_output
          )
          [execution] = m.store.get_executions_by_id([execution_id])
          self.assertProtoPartiallyEquals(
              """
            id: 1
            last_known_state: FAILED
            custom_properties {
              key: '__execution_result__'
              value {
                string_value: '{\\n  "resultMessage": "error message.",\\n  "code": 1\\n}'
              }
            }
            """,
              execution,
              ignored_fields=[
                  "type_id",
                  "type",
                  "create_time_since_epoch",
                  "last_update_time_since_epoch",
                  "name",
              ],
          )
          # No events because there is no artifact published.
          events = m.store.get_events_by_execution_ids([execution.id])
          self.assertEmpty(events)
          # Verifies the context-execution edges are set up.
          self.assertCountEqual(
              [c.id for c in contexts],
              [
                  c.id
                  for c in m.store.get_contexts_by_execution(
                      execution.id
                  )
              ],
          )
  
imports: import copy
  from absl.testing import parameterized
  import tensorflow
  from tfx import version
  from tfx.orchestration import metadata
  from tfx.orchestration.portable import execution_publish_utils
  from tfx.orchestration.portable import outputs_utils
  from tfx.orchestration.portable.mlmd import context_lib
  from tfx.orchestration.portable.mlmd import execution_lib
  from tfx.proto.orchestration import execution_result_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.types import artifact
  from tfx.types import artifact_utils
  from tfx.types import standard_artifacts
  from tfx.utils import test_case_utils
  from google.protobuf import text_format
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 15 for calling the ExecutionPublisherTest obj's underlying member method code with example usage: obj.testPublishFailedExecution() without return types