コード例 #1
0
    def stop(self):
        """
        This is called to stop the viewpoint by call ints quit method and
        then telling it to quit via kill if needs be.

        This method can potentially be called again after a call to start,
        bear this in mind.

        :return: None

        """
        rc = proc.check(self.commandProc)
        if rc:
            # Ask the viewpoint nicely to shutdown:
            self.log.info("stop: asking viewpoint to shutdown.")
            try:
                rc = self.dbc.browserQuit()
            except viewpointdirect.BrowserNotPresent:
                pass

            self.log.info(
                "stop: stopping the viewpoint PID:'%s' and all its children." %
                self.pid)
            proc.kill(self.pid)
        else:
            self.log.warn("stop: viewpoint not running to stop it.")
コード例 #2
0
    def isStopped(self):
        """
        This is called to wait for the process to finish stopping.

        This method is called directly after a call to the stop method and
        it is acceptable to block waiting.

        :return: True if the process has stopped otherwise False

        """
        return proc.check(self.commandProc)
コード例 #3
0
    def isStarted(self):
        """
        This is called to wait for the process to finish loading and report
        is ready.

        This method is called directly after a call to the start method and
        it is acceptable to block waiting.

        :return: True if the process is running otherwise False

        """
        return proc.check(self.commandProc)
コード例 #4
0
    def isStopped(self):
        """
        Check the xulrunner process is stopped by checking the control
        port and the process

        :return: True if the process has stopped otherwise False

        """
        rc = proc.check(self.commandProc)
        if rc:
            # Check if the comms port is closed:
            rc = self.dbc.waitForReady(retries=5)

        return rc
コード例 #5
0
    def isStopped(self):
        """
        Check the xulrunner process is stopped by checking the control
        port and the process

        :return: True if the process has stopped otherwise False

        """
        rc = proc.check(self.commandProc)
        if rc:
            # Check if the comms port is closed:
            rc = self.dbc.waitForReady(retries=5)

        return rc
コード例 #6
0
    def isStarted(self):
        """
        Check the xulrunner process is running and then attempt to connect
        to its control port.

        :return: True if the process is running otherwise False

        """
        if not self.test_method == 'disable':
            rc = proc.check(self.commandProc)
            if rc:
                if self.dbc.waitForReady(retries=1):
                    if self.checkForURIReadiness(self.uri):
                        self.setURI(self.uri)
        else:
            rc = True

        return rc
コード例 #7
0
    def isStarted(self):
        """
        Check the xulrunner process is running and then attempt to connect
        to its control port.

        :return: True if the process is running otherwise False

        """
        if not self.test_method == 'disable':
            rc = proc.check(self.commandProc)
            if rc:
                if self.dbc.waitForReady(retries=1):
                    if self.checkForURIReadiness(self.uri):
                        self.setURI(self.uri)
        else:
            rc = True

        return rc
コード例 #8
0
    def start(self):
        """
        This starts the viewpoint app.

        If start is called after the first call, it will be
        ignored and a warning to that effect will be logged.

        :return: None

        """
        if not proc.check(self.commandProc):
            self.log.debug("start: command '%s'." % self.command)
            self.commandProc = subprocess.Popen(
                args=self.command,
                shell=True,
                cwd=self.workingdir,
                )
            self.pid = self.commandProc.pid

        else:
            self.log.warn("start: The viewpoint '%s' is running, please call stop first!" % self.pid)
コード例 #9
0
    def start(self):
        """
        This starts a new process based on the command line and
        working directory configured by the end user.

        If start is called after the first call, it will be
        ignored and a warning to that effect will be logged.

        :return: None

        """
        if not proc.check(self.commandProc):
            self.commandProc = subprocess.Popen(
                args=self.command,
                shell=True,
                cwd=self.workingdir,
                )

            self.pid = self.commandProc.pid
            self.log.info("start:  '%s' running. PID %s" % (self.command, self.pid))

        else:
            self.log.warn("start: The process '%s' is running, please call stop first!" % self.pid)
コード例 #10
0
    def start(self):
        """
        This starts the viewpoint app.

        If start is called after the first call, it will be
        ignored and a warning to that effect will be logged.

        :return: None

        """
        if not proc.check(self.commandProc):
            self.log.debug("start: command '%s'." % self.command)
            self.commandProc = subprocess.Popen(
                args=self.command,
                shell=True,
                cwd=self.workingdir,
            )
            self.pid = self.commandProc.pid

        else:
            self.log.warn(
                "start: The viewpoint '%s' is running, please call stop first!"
                % self.pid)
コード例 #11
0
    def stop(self):
        """
        This is called to stop the viewpoint by call ints quit method and
        then telling it to quit via kill if needs be.

        This method can potentially be called again after a call to start,
        bear this in mind.

        :return: None

        """
        rc = proc.check(self.commandProc)
        if rc:
            # Ask the viewpoint nicely to shutdown:
            self.log.info("stop: asking viewpoint to shutdown.")
            try:
                rc = self.dbc.browserQuit()
            except viewpointdirect.BrowserNotPresent:
                pass

            self.log.info("stop: stopping the viewpoint PID:'%s' and all its children." % self.pid)
            proc.kill(self.pid)
        else:
            self.log.warn("stop: viewpoint not running to stop it.")