def __init__(
        self,
        pack,
        file_path,
        class_name,
        trigger_types,
        poll_interval=None,
        parent_args=None,
        db_ensure_indexes=True,
    ):
        """
        :param pack: Name of the pack this sensor belongs to.
        :type pack: ``str``

        :param file_path: Path to the sensor module file.
        :type file_path: ``str``

        :param class_name: Sensor class name.
        :type class_name: ``str``

        :param trigger_types: A list of references to trigger types which
                                  belong to this sensor.
        :type trigger_types: ``list`` of ``str``

        :param poll_interval: Sensor poll interval (in seconds).
        :type poll_interval: ``int`` or ``None``

        :param parent_args: Command line arguments passed to the parent process.
        :type parse_args: ``list``

        :param db_ensure_indexes: True to ensure indexes. This should really only be set to False
                                  in tests to speed things up.
        """
        self._pack = pack
        self._file_path = file_path
        self._class_name = class_name
        self._trigger_types = trigger_types or []
        self._poll_interval = poll_interval
        self._parent_args = parent_args or []
        self._trigger_names = {}

        # 1. Parse the config with inherited parent args
        try:
            config.parse_args(args=self._parent_args)
        except Exception:
            LOG.exception(
                "Failed to parse config using parent args "
                '(parent_args=%s): "%s".' % (str(self._parent_args))
            )

        # 2. Establish DB connection
        username = (
            cfg.CONF.database.username
            if hasattr(cfg.CONF.database, "username")
            else None
        )
        password = (
            cfg.CONF.database.password
            if hasattr(cfg.CONF.database, "password")
            else None
        )
        db_setup_with_retry(
            cfg.CONF.database.db_name,
            cfg.CONF.database.host,
            cfg.CONF.database.port,
            username=username,
            password=password,
            ensure_indexes=db_ensure_indexes,
            tls=cfg.CONF.database.tls,
            tls_certificate_key_file=cfg.CONF.database.tls_certificate_key_file,
            tls_certificate_key_file_password=cfg.CONF.database.tls_certificate_key_file_password,
            tls_allow_invalid_certificates=cfg.CONF.database.tls_allow_invalid_certificates,
            tls_ca_file=cfg.CONF.database.tls_ca_file,
            ssl_cert_reqs=cfg.CONF.database.ssl_cert_reqs,  # deprecated
            authentication_mechanism=cfg.CONF.database.authentication_mechanism,
            ssl_match_hostname=cfg.CONF.database.ssl_match_hostname,
        )

        # 3. Instantiate the watcher
        self._trigger_watcher = TriggerWatcher(
            create_handler=self._handle_create_trigger,
            update_handler=self._handle_update_trigger,
            delete_handler=self._handle_delete_trigger,
            trigger_types=self._trigger_types,
            queue_suffix="sensorwrapper_%s_%s" % (self._pack, self._class_name),
            exclusive=True,
        )

        # 4. Set up logging
        self._logger = logging.getLogger(
            "SensorWrapper.%s.%s" % (self._pack, self._class_name)
        )
        logging.setup(cfg.CONF.sensorcontainer.logging)

        if "--debug" in parent_args:
            set_log_level_for_all_loggers()
        else:
            # NOTE: statsd logger logs everything by default under INFO so we ignore those log
            # messages unless verbose / debug mode is used
            logging.ignore_statsd_log_messages()

        self._sensor_instance = self._get_sensor_instance()

        :param pack: Name of the pack this sensor belongs to.
        :type pack: ``str``

        :param file_path: Path to the sensor module file.
        :type file_path: ``str``

        :param class_name: Sensor class name.
        :type class_name: ``str``

        :param trigger_types: A list of references to trigger types which
                                  belong to this sensor.
        :type trigger_types: ``list`` of ``str``

        :param poll_interval: Sensor poll interval (in seconds).
        :type poll_interval: ``int`` or ``None``

        :param parent_args: Command line arguments passed to the parent process.
        :type parse_args: ``list``

        :param db_ensure_indexes: True to ensure indexes. This should really only be set to False
                                  in tests to speed things up.
        
st2reactor/st2reactor/container/sensor_wrapper.py