API Documentation

This is automatically generated documentation from the source code. Generally this will only be useful for developers.

Submodules

pgctl.cli module

class pgctl.cli.PgctlApp(config=<frozendict {u'force': False, u'verbose': False, u'pgdir': u'playground', u'json': False, u'timeout': u'2.0', u'services': (u'default', ), u'poll': u'.01', u'pghome': u'~/.run/pgctl', u'aliases': <frozendict {u'default': (u'(all services)', )}>}>)

Bases: object

all_services

Return a list of all services.

Returns:list of Service objects
Return type:list
commands = (<function start>, <function stop>, <function status>, <function restart>, <function reload>, <function log>, <function debug>, <function config>)
config()

Print the configuration for a service

debug()

Allow a service to run in the foreground

log(interactive=None)

Displays the stdout and stderr for a service or group of services

pgdir

Retrieve the set playground directory

pghome

Retrieve the set pgctl home directory.

By default, this is “$XDG_RUNTIME_DIR/pgctl”.

playground_locked(*args, **kwds)

Lock the entire playground.

reload()

Reloads the configuration for a service

restart()

Starts and stops a service

service_by_name(service_name)

Return an instantiated Service, by name.

service_names
services

Return a tuple of the services for a command

Returns:tuple of Service objects
start()

Idempotent start of a service or group of services

status()

Retrieve the PID and state of a service or group of services

stop(with_log_running=False)

Idempotent stop of a service or group of services

Parameters:with_log_running – controls whether the logger associated with

this service should be stopped or left running. For restart cases, we want to leave the logger running (since poll-ready may still be writing log messages).

with_services(services)

return a similar PgctlApp, but with a different set of services

class pgctl.cli.Start(service)

Bases: pgctl.cli.StateChange

assert_()
change()
fail()
get_timeout()
is_user_facing = True
class strings

Bases: object

change = u'start'
changed = u'Started:'
changing = u'Starting:'
class pgctl.cli.StateChange(service)

Bases: object

class pgctl.cli.StateChangeResult

Bases: object

FAILURE = 1
RECHECK_NEEDED = 2
SUCCESS = 0
class pgctl.cli.Stop(service)

Bases: pgctl.cli.StateChange

assert_()
change()
fail()
get_timeout()
is_user_facing = True
class strings

Bases: object

change = u'stop'
changed = u'Stopped:'
changing = u'Stopping:'
class pgctl.cli.StopLogs(service)

Bases: pgctl.cli.StateChange

assert_()
change()
fail()
get_timeout()
is_user_facing = False
class strings

Bases: object

change = u'stop'
changed = u'Stopped logger for:'
changing = u'Stopping logger for:'
class pgctl.cli.TermStyle

Bases: object

BOLD = u'\x1b[1m'
ENDC = u'\x1b[0m'
GREEN = u'\x1b[92m'
RED = u'\x1b[91m'
YELLOW = u'\x1b[93m'
classmethod wrap(text, style)
pgctl.cli.error_message_on_timeout(service, error, action_name, actual_timeout_length, check_length)
pgctl.cli.main(argv=None)
pgctl.cli.parser()
pgctl.cli.pgctl_print(*print_args, **print_kwargs)

Print to stderr with [pgctl] prepended.

pgctl.cli.timeout(service, start_time, check_time, curr_time)
pgctl.cli.unbuf_print(*args, **kwargs)

Print unbuffered in utf8.

Module contents