code: def _validate_min_count(
      input_key: str,
      min_count: int,
      channel: channel_types.OutputChannel,
      consumer_node: base_node.BaseNode,
  ) -> None:
      """Validates artifact min count against node execution options.
  
      Note that the validation is not comprehensive. It only applies to components
      in the same pipeline. Other min_count violations will be handled as node
      failure at run time.
  
      Args:
        input_key: Artifact input key to be displayed in error messages.
        min_count: Minimum artifact count to be set in InputSpec.
        channel: OutputChannel used as an input to be compiled.
        consumer_node: Node using the artifact as an input.
  
      Raises:
        ValueError: if min_count is invalid.
  
      Returns:
        None if the validation passes.
      """
      producer_options = (
          channel.producer_component.node_execution_options
      )
      if (
          producer_options
          and producer_options.success_optional
          and min_count > 0
      ):
          raise ValueError(
              f"Node({channel.producer_component_id}) is set to success_optional "
              f"= True but its consumer Node({consumer_node.id}).inputs[{input_key}] "
              "has min_count > 0. The consumer's input may need to be optional"
          )
  
      consumer_options = consumer_node.node_execution_options
      if (
          consumer_options
          and consumer_options.trigger_strategy
          in (
              pipeline_pb2.NodeExecutionOptions.ALL_UPSTREAM_NODES_COMPLETED,
              pipeline_pb2.NodeExecutionOptions.LAZILY_ALL_UPSTREAM_NODES_COMPLETED,
          )
          and min_count > 0
      ):
          raise ValueError(
              f"Node({consumer_node.id}) has trigger_strategy ="
              f" {pipeline_pb2.NodeExecutionOptions.TriggerStrategy.Name(consumer_options.trigger_strategy)} but"
              f" its inputs[{input_key}] has min_count > 0. The consumer's input may"
              " need to be optional"
          )
  
imports: from typing import Type, cast
  from tfx import types
  from tfx.dsl.compiler import compiler_context
  from tfx.dsl.compiler import compiler_utils
  from tfx.dsl.compiler import constants
  from tfx.dsl.components.base import base_component
  from tfx.dsl.components.base import base_node
  from tfx.dsl.experimental.conditionals import conditional
  from tfx.dsl.input_resolution import resolver_op
  from tfx.dsl.placeholder import artifact_placeholder
  from tfx.dsl.placeholder import placeholder
  from tfx.orchestration import data_types_utils
  from tfx.proto.orchestration import metadata_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.types import channel
  from tfx.types import channel_utils
  from tfx.types import resolved_channel
  from tfx.types import value_artifact
  from tfx.utils import deprecation_utils
  from tfx.utils import name_utils
  from tfx.utils import typing_utils
label_desc: Use image node_id 6 for calling a global function with example usage: _validate_min_count(input_key, min_count, channel, consumer_node) without return types