Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add wait option to start and stop functions#45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
funbringer merged 3 commits intopostgrespro:masterfromildus:master
Apr 10, 2018
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletionstestgres/node.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -564,12 +564,13 @@ def get_control_data(self):

return out_dict

def start(self, params=[]):
def start(self, params=[], wait=True):
"""
Start this node using pg_ctl.

Args:
params: additional arguments for pg_ctl.
wait: wait until operation completes.

Returns:
This instance of :class:`.PostgresNode`.
Expand All@@ -579,7 +580,7 @@ def start(self, params=[]):
get_bin_path("pg_ctl"),
"-D", self.data_dir,
"-l", self.pg_log_file,
"-w", # wait
"-w" if wait else '-W', #--wait or --no-wait
"start"
] + params # yapf: disable

Expand All@@ -594,12 +595,13 @@ def start(self, params=[]):

return self

def stop(self, params=[]):
def stop(self, params=[], wait=True):
"""
Stop this node using pg_ctl.

Args:
params: additional arguments for pg_ctl.
wait: wait until operation completes.

Returns:
This instance of :class:`.PostgresNode`.
Expand All@@ -608,7 +610,7 @@ def stop(self, params=[]):
_params = [
get_bin_path("pg_ctl"),
"-D", self.data_dir,
"-w", # wait
"-w" if wait else '-W', #--wait or --no-wait
"stop"
] + params # yapf: disable

Expand Down
12 changes: 12 additions & 0 deletionstests/test_simple.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -373,6 +373,18 @@ def test_backup_wrong_xlog_method(self):
BackupException, msg='Invalid xlog_method "wrong"'):
node.backup(xlog_method='wrong')

def test_pg_ctl_wait_option(self):
with get_new_node() as node:
node.init().start(wait=False)
while True:
try:
node.stop(wait=False)
break
except ExecUtilException:
# it's ok to get this exception here since node
# could be not started yet
pass

def test_replicate(self):
with get_new_node() as node:
node.init(allow_streaming=True).start()
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp