How to use the pgctl.errors.PgctlUserMessage function in pgctl

To help you get started, we’ve selected a few pgctl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Yelp / pgctl / pgctl / cli.py View on Github external
childpid = os.fork()
        if childpid:
            os.waitpid(childpid, 0)
        else:
            os.dup2(2, 1)  # send log to stderr
            failapp.log(interactive=False)  # doesn't return
        if state == 'start':
            # we don't want services that failed to start to be 'up'
            failapp.stop()

        pgctl_print()
        pgctl_print('There might be useful information further up in the log; you can view it by running:')
        for service in failapp.services:
            pgctl_print('    less +G {}'.format(bestrelpath(service.path.join('logs', 'current').strpath)))

        raise PgctlUserMessage('Some services failed to %s: %s' % (state, commafy(failed)))
github Yelp / pgctl / pgctl / cli.py View on Github external
def reload(self):
        """Reloads the configuration for a service"""
        pgctl_print('reload:', commafy(self.service_names))
        raise PgctlUserMessage('reloading is not yet implemented.')
github Yelp / pgctl / pgctl / errors.py View on Github external
"""The pgctl supervision process has gone missing."""


class PgctlUserMessage(Exception):
    """
    This is the class of user messages, as distinct from programmer errors.
    For some cases, there's nothing better to do than send a message to the user.
    When that happens, we don't need or want a stack trace.
    """


class CircularAliases(PgctlUserMessage):
    """The user has configured their pgctl aliases with a circular definition."""


class NoPlayground(PgctlUserMessage):
    """The pgctl system could find no playground to operate on."""


class NoSuchService(PgctlUserMessage):
    """The pgctl system could find the indicated playground service to operate on."""


class LockHeld(PgctlUserMessage):
    """The pgctl supervision lock is held. This generally indicates subprocesses escaping supervision."""


class NotReady(PgctlUserMessage):
    """The service is still performing its previous state change."""
github Yelp / pgctl / pgctl / cli.py View on Github external
def debug(self):
        """Allow a service to run in the foreground"""
        try:
            # start supervise in the foreground with the service up
            service, = self.services
        except ValueError:
            raise PgctlUserMessage(
                'Must debug exactly one service, not: ' + commafy(self.service_names),
            )

        if service.state['state'] != 'down':
            self.stop()

        self._run_playground_wide_hook('pre-start')
        service.foreground()  # never returns
github Yelp / pgctl / pgctl / errors.py View on Github external
"""raised only in cases that we believe to be impossible"""


class Unsupervised(Exception):
    """The pgctl supervision process has gone missing."""


class PgctlUserMessage(Exception):
    """
    This is the class of user messages, as distinct from programmer errors.
    For some cases, there's nothing better to do than send a message to the user.
    When that happens, we don't need or want a stack trace.
    """


class CircularAliases(PgctlUserMessage):
    """The user has configured their pgctl aliases with a circular definition."""


class NoPlayground(PgctlUserMessage):
    """The pgctl system could find no playground to operate on."""


class NoSuchService(PgctlUserMessage):
    """The pgctl system could find the indicated playground service to operate on."""


class LockHeld(PgctlUserMessage):
    """The pgctl supervision lock is held. This generally indicates subprocesses escaping supervision."""


class NotReady(PgctlUserMessage):
github Yelp / pgctl / pgctl / errors.py View on Github external
"""The user has configured their pgctl aliases with a circular definition."""


class NoPlayground(PgctlUserMessage):
    """The pgctl system could find no playground to operate on."""


class NoSuchService(PgctlUserMessage):
    """The pgctl system could find the indicated playground service to operate on."""


class LockHeld(PgctlUserMessage):
    """The pgctl supervision lock is held. This generally indicates subprocesses escaping supervision."""


class NotReady(PgctlUserMessage):
    """The service is still performing its previous state change."""