コード例 #1
0
    def __init__(self, command, url, **kwargs):
        """
        Initialize HTTPExecutor executor.

        :param (str, list) command: command to be run by the subprocess
        :param str url: URL that executor checks to verify
            if process has already started.
        :param bool shell: same as the `subprocess.Popen` shell definition
        :param int timeout: number of seconds to wait for the process to start
            or stop. If None or False, wait indefinitely.
        :param float sleep: how often to check for start/stop condition
        :param int sig_stop: signal used to stop process run by the executor.
            default is `signal.SIGTERM`
        :param int sig_kill: signal used to kill process run by the executor.
            default is `signal.SIGKILL`

        """
        self.url = urlparse(url)
        """
        An :func:`urlparse.urlparse` representation of an url.

        It'll be used to check process status on.
        """

        port = self.url.port
        if port is None:
            port = self.DEFAULT_PORT

        super(HTTPExecutor, self).__init__(command,
                                           host=self.url.hostname,
                                           port=port,
                                           **kwargs)
コード例 #2
0
    def __init__(self, command, url, **kwargs):
        """
        Initialize HTTPExecutor executor.

        :param (str, list) command: command to run to start service
        :param str url: url where executor can check
            if process has already started.
        :param bool shell: see `subprocess.Popen`
        :param int timeout: time to wait for process to start or stop.
            if None, wait indefinitely.
        :param float sleep: how often to check for start/stop condition
        :param int sig_stop: signal used to stop process run by executor.
            default is SIGTERM
        :param int sig_kill: signal used to kill process run by  executor.
            default is SIGKILL
        """
        self.url = urlparse(url)
        """
        An :func:`urlparse.urlparse` representation of an url.

        It'll be used to check process status on."""

        super(HTTPExecutor, self).__init__(command,
                                           host=self.url.hostname,
                                           port=self.url.port,
                                           **kwargs)
コード例 #3
0
ファイル: http.py プロジェクト: pombredanne/mirakuru
    def __init__(self, command, url, **kwargs):
        """
        Initialize HTTPExecutor executor.

        :param (str, list) command: command to be run by the subprocess
        :param str url: URL that executor checks to verify
            if process has already started.
        :param bool shell: same as the `subprocess.Popen` shell definition
        :param int timeout: number of seconds to wait for the process to start
            or stop. If None or False, wait indefinitely.
        :param float sleep: how often to check for start/stop condition
        :param int sig_stop: signal used to stop process run by the executor.
            default is `signal.SIGTERM`
        :param int sig_kill: signal used to kill process run by the executor.
            default is `signal.SIGKILL`

        """
        self.url = urlparse(url)
        """
        An :func:`urlparse.urlparse` representation of an url.

        It'll be used to check process status on.
        """

        port = self.url.port
        if port is None:
            port = self.DEFAULT_PORT

        super(HTTPExecutor, self).__init__(
            command, host=self.url.hostname, port=port, **kwargs
        )
コード例 #4
0
ファイル: http.py プロジェクト: robmessick/mirakuru
    def __init__(self, command, url, **kwargs):
        """
        Initialize HTTPExecutor executor.

        :param (str, list) command: command to run to start service
        :param str url: url where executor can check
            if process has already started.
        :param bool shell: see `subprocess.Popen`
        :param int timeout: time to wait for process to start or stop.
            if None, wait indefinitely.
        :param float sleep: how often to check for start/stop condition
        :param int sig_stop: signal used to stop process run by executor.
            default is SIGTERM
        :param int sig_kill: signal used to kill process run by  executor.
            default is SIGKILL
        """
        self.url = urlparse(url)
        """
        An :func:`urlparse.urlparse` representation of an url.

        It'll be used to check process status on."""

        super(HTTPExecutor, self).__init__(
            command, host=self.url.hostname, port=self.url.port, **kwargs
        )
コード例 #5
0
ファイル: http.py プロジェクト: js-cc/mirakuru
    def __init__(self, command, url, shell=False, timeout=None, sleep=0.1):
        """
        Initialize HTTPExecutor executor.

        :param str command: command to run to start service
        :param str url: url where executor can check
            if process has already started.
        :param bool shell: see `subprocess.Popen`
        :param int timeout: time to wait for process to start or stop.
            if None, wait indefinitely.
        :param float sleep: how often to check for start/stop condition
        """
        self.url = urlparse(url)
        """
        An :func:`urlparse.urlparse` representation of an url.

        It'll be used to check process status on."""

        TCPExecutor.__init__(
            self, command, host=self.url.hostname,
            port=self.url.port, shell=shell, timeout=timeout, sleep=sleep)
コード例 #6
0
    def __init__(self, command, url, status=r'^2\d\d$', **kwargs):
        """
        Initialize HTTPExecutor executor.

        :param (str, list) command: command to be run by the subprocess
        :param str url: URL that executor checks to verify
            if process has already started.
        :param bool shell: same as the `subprocess.Popen` shell definition
        :param str|int status: HTTP status code(s) that an endpoint must
            return for the executor being considered as running. This argument
            is interpreted as a single status code - e.g. '200' or '404' but
            also it can be a regular expression - e.g. '4..' or '(200|404)'.
            Default: any 2XX HTTP status code.
        :param int timeout: number of seconds to wait for the process to start
            or stop. If None or False, wait indefinitely.
        :param float sleep: how often to check for start/stop condition
        :param int sig_stop: signal used to stop process run by the executor.
            default is `signal.SIGTERM`
        :param int sig_kill: signal used to kill process run by the executor.
            default is `signal.SIGKILL`

        """
        self.url = urlparse(url)
        """
        An :func:`urlparse.urlparse` representation of an url.

        It'll be used to check process status on.
        """

        port = self.url.port
        if port is None:
            port = self.DEFAULT_PORT

        self.status = str(status)
        self.status_re = re.compile(str(status))

        super(HTTPExecutor, self).__init__(command,
                                           host=self.url.hostname,
                                           port=port,
                                           **kwargs)