code: def init():
      """Initialises the singleton _EventObserver.
  
      register_observer() and notify() will use the singleton _EventObserver while
      within this context. The singleton EventObserver will be initialised on
      entering this context, and shut down on exiting this context.
  
      Raises:
        RuntimeError: If this context is invoked again when it is already active.
  
      Yields:
        Nothing.
      """
      global _event_observer
      global _event_observer_lock
  
      with _event_observer_lock:
          if _event_observer is not None:
              raise RuntimeError(
                  "nested calls to init() are prohibited"
              )
          _event_observer = _EventObserver()
          _event_observer.start()
  
      try:
          yield
      finally:
          with _event_observer_lock:
              _event_observer.shutdown()
              _event_observer = None
  
imports: from concurrent import futures
  import contextlib
  import dataclasses
  import queue
  import threading
  from typing import Any, Callable, List, Optional, Union
  from absl import logging
  from tfx.orchestration.experimental.core import task
  from tfx.utils import status
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: init() without return types