class_docstr: A specification of Beam executor.
  
  Attributes:
    executor_class: a subclass of base_executor.BaseExecutor used to execute
      this component (required).
    extra_flags: extra flags to be set in the Python base executor.
    beam_pipeline_args: arguments for Beam powered Components.
class_docstr_tok: ["A","specification","of","Beam","executor",".","Attributes",":","executor_class",":","a","subclass","of","base_executor.BaseExecutor","used","to","execute","this","component","(","required",")",".","extra_flags",":","extra","flags","to","be","set","in","the","Python","base","executor",".","beam_pipeline_args",":","arguments","for","Beam","powered","Components","."]
code: def encode(
      self, component_spec: Optional[types.ComponentSpec] = None
  ) -> message.Message:
      result = executable_spec_pb2.BeamExecutableSpec()
      result.python_executor_spec.CopyFrom(
          super().encode(component_spec=component_spec)
      )
      placeholder_beam_pipeline_args = []
      # TODO(b/251703242): Remove str_beam_pipeline_args and deprecate
      # `beam_pipeline_args`.
      str_beam_pipeline_args = []
      for beam_pipeline_arg in self.beam_pipeline_args:
          if isinstance(beam_pipeline_arg, str):
              str_ph = placeholder_pb2.PlaceholderExpression()
              str_ph.value.string_value = beam_pipeline_arg
              placeholder_beam_pipeline_args.append(str_ph)
              str_beam_pipeline_args.append(beam_pipeline_arg)
          elif isinstance(beam_pipeline_arg, ph.Placeholder):
              placeholder_beam_pipeline_args.append(
                  beam_pipeline_arg.encode()
              )
          else:
              raise ValueError(
                  f"Unsupported arg type:{type(beam_pipeline_arg)}"
              )
      result.beam_pipeline_args_placeholders.extend(
          placeholder_beam_pipeline_args
      )
      result.beam_pipeline_args.extend(str_beam_pipeline_args)
      return result
  
imports: import copy
  from typing import cast, Iterable, List, Optional, Type, Union
  from tfx import types
  from tfx.dsl.components.base import base_executor
  from tfx.dsl.placeholder import placeholder
  from tfx.proto.orchestration import executable_spec_pb2
  from tfx.proto.orchestration import placeholder_pb2
  from tfx.utils import import_utils
  from tfx.utils import json_utils
  from tfx.utils import name_utils
  from google.protobuf import message
label_desc: Use image node_id 2 for calling the BeamExecutorSpec obj's underlying member method code with example usage: obj.encode(component_spec) and returns: result