code: def make_program(num_producers: int) -> lp.Program:
      """Define the distributed program topology."""
      program = lp.Program("consumer_producers")
  
      # Use `program.group()` to group homogeneous nodes.
      with program.group("producer"):
          # Add a `CourierNode` to the program. `lp.CourierNode()` takes the producer
          # constructor and its arguments, and exposes it as an RPC server.
          # `program.add_node(lp.CourierNode(...))` returns a handle to this server.
          # These handles can then be passed to other nodes.
          producers = [
              program.add_node(lp.CourierNode(Producer))
              for _ in range(num_producers)
          ]
  
      # Launch a single consumer that connects to the list of producers.
      # Note: The use of `label` here actually creates a group with one single node.
      node = lp.CourierNode(Consumer, producers=producers)
      program.add_node(node, label="consumer")
  
      return program
  
file_path: launchpad/launchpad/examples/consumer_producers/program.py
imports: from typing import List
  from absl import logging
  import launchpad
label_desc: Use image node_id 1 for calling a global function with example usage: make_program(num_producers) and returns: program