@gen.coroutine
    @util.debuglog
    def _start(self):
        """Start.
        """
        if self.pending_socket_event:
            return

        if not self.is_stopped():
            if len(self.processes) < self.numprocesses:
                self.reap_processes()
                yield self.spawn_processes()
            return

        found_wids = len(self._found_wids)
        if not self._found_wids and not self.call_hook('before_start'):
            logger.debug('Aborting startup')
            return

        self._status = "starting"

        if self.stdout_stream and hasattr(self.stdout_stream, 'open'):
            self.stdout_stream.open()
        if self.stderr_stream and hasattr(self.stderr_stream, 'open'):
            self.stderr_stream.open()

        self._create_redirectors()
        self.reap_processes()
        yield self.spawn_processes()

        # If not self.processes, the before_spawn or after_spawn hooks have
        # probably prevented startup so give up
        if not self.processes or not self.call_hook('after_start'):
            logger.debug('Aborting startup')
            # stop streams too since we are bailing on this watcher completely
            yield self._stop(True)
            return

        self._status = "active"
        if found_wids:
            logger.info('%s already running' % self.name)
        else:
            logger.info('%s started' % self.name)
        self.notify_event("start", {"time": time.time()})
dataset/ETHPy150Open circus-tent/circus/circus/watcher.py/Watcher._start/original