code: def aw_parse_args():
      """Parse the application arguments into setup parameters"""
      from cellprofiler_core.preferences import (
          set_headless,
          set_awt_headless,
          set_plugin_directory,
      )
      import optparse
  
      global analysis_id
      global work_server_address
      global notify_address
      global knime_bridge_address
      set_headless()
      set_awt_headless(True)
      parser = optparse.OptionParser()
      parser.add_option(
          "--analysis-id",
          dest="analysis_id",
          help="Unique ID for the analysis to be performed",
          default=None,
      )
      parser.add_option(
          "--work-server",
          dest="work_server_address",
          help="ZMQ port where work requests should be sent",
          default=None,
      )
      parser.add_option(
          "--notify-server",
          dest="notify_address",
          help="ZMQ port where continue/shutdown notifications are published",
          default=None,
      )
      parser.add_option(
          "--log-level",
          dest="log_level",
          type="int",
          help="Logging level for logger: DEBUG, INFO, WARNING, ERROR",
          default=os.environ.get(AW_LOG_LEVEL, logging.INFO),
      )
      parser.add_option(
          "--plugins-directory",
          dest="plugins_directory",
          help="Folder containing the CellProfiler plugin modules needed by client pipelines",
          default=None,
      )
      parser.add_option(
          "--conserve-memory",
          dest="conserve_memory",
          default=None,
          help="CellProfiler will attempt to release unused memory after each image set.",
      )
      parser.add_option(
          "--jvm-heap-size",
          dest="jvm_heap_size",
          default=None,
          help=(
              "This is the amount of memory reserved for the "
              "Java Virtual Machine (similar to the java -Xmx switch)."
              "Example formats: 512000k, 512m, 1g"
          ),
      )
      parser.add_option(
          "--knime-bridge-address",
          dest="knime_bridge_address",
          help="Open up a port to handle the Knime bridge protocol",
          default=None,
      )
      parser.add_option(
          "--always-continue",
          dest="always_continue",
          help="Don't stop the analysis when an image set raises an error",
          default=None,
      )
  
      options, args = parser.parse_args()
  
      logging.root.setLevel(options.log_level)
      if len(logging.root.handlers) == 0:
          stream_handler = logging.StreamHandler()
          fmt = logging.Formatter(
              "%(process)d|%(levelno)s|%(name)s::%(funcName)s: %(message)s"
          )
          stream_handler.setFormatter(fmt)
          logging.root.addHandler(stream_handler)
  
      if (
          not options.work_server_address
          and options.work_server_address
          and options.analysis_id
      ):
          parser.print_help()
          sys.exit(1)
      analysis_id = options.analysis_id
      notify_address = options.notify_address
      work_server_address = options.work_server_address
      knime_bridge_address = options.knime_bridge_address
  
      #
      # Set up the headless plugins directories before doing
      # anything so loading will get them
      #
      if options.plugins_directory is not None:
          set_plugin_directory(
              options.plugins_directory, globally=False
          )
      if options.conserve_memory is not None:
          set_conserve_memory(options.conserve_memory, globally=False)
      if options.always_continue is not None:
          set_always_continue(options.always_continue, globally=False)
      else:
          LOGGER.warning("Plugins directory not set")
  
file_path: CellProfiler/src/subpackages/core/cellprofiler_core/worker/__init__.py
imports: import logging
  import os
  import sys
  import psutil
  import pkg_resources
  from cellprofiler_core.constants.worker import DEADMAN_START_ADDR, DEADMAN_START_MSG, NOTIFY_STOP, all_measurements, NOTIFY_ADDR
  from cellprofiler_core.preferences import set_always_continue, set_conserve_memory
  from cellprofiler_core.worker._worker import Worker
  import time
  import threading
  import zmq
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: aw_parse_args() without return types