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

Use kwargs for several functions to move through all possible arguments#36

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
Feb 28, 2018
Merged
Changes from1 commit
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
NextNext commit
Use kwargs for several functions to move through all possible arguments
  • Loading branch information
@ildus
ildus committedFeb 28, 2018
commit8e5b09d66ca3fd5bad0c380aea5086e44f71f59c
29 changes: 10 additions & 19 deletionstestgres/node.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,7 +112,7 @@ def __enter__(self):
def __exit__(self, type, value, traceback):
self.free_port()

# NOTE:ctrl+C does not count!
# NOTE:Ctrl+C does not count!
got_exception = type is not None and type != KeyboardInterrupt

c1 = self.cleanup_on_good_exit and not got_exception
Expand DownExpand Up@@ -681,16 +681,13 @@ def psql(self,
return process.returncode, out, err

@method_decorator(positional_args_hack(['dbname', 'query']))
def safe_psql(self,
query,
dbname=None,
username=None,
input=None):
def safe_psql(self, query=None, **kwargs):
"""
Execute a query using psql.

Args:
query: query to be executed.
filename: file with a query.
dbname: database name to connect to.
username: database user name.
input: raw input to be passed.
Expand All@@ -699,10 +696,7 @@ def safe_psql(self,
psql's output as str.
"""

ret, out, err = self.psql(query=query,
dbname=dbname,
username=username,
input=input)
ret, out, err = self.psql(query=query, **kwargs)
if ret:
raise QueryException((err or b'').decode('utf-8'), query)

Expand DownExpand Up@@ -858,37 +852,34 @@ def execute(self,

return res

def backup(self,username=None, xlog_method=DEFAULT_XLOG_METHOD):
def backup(self,**kwargs):
"""
Perform pg_basebackup.

Args:
username: database user name.
xlog_method: a method for collecting the logs ('fetch' | 'stream').
base_dir: the base directory for data files and logs

Returns:
A smart object of type NodeBackup.
"""

from .backup import NodeBackup
return NodeBackup(node=self,
username=username,
xlog_method=xlog_method)
return NodeBackup(node=self, **kwargs)

def replicate(self,
name=None,
username=None,
xlog_method=DEFAULT_XLOG_METHOD):
def replicate(self, name=None, **kwargs):
"""
Create a binary replica of this node.

Args:
name: replica's application name.
username: database user name.
xlog_method: a method for collecting the logs ('fetch' | 'stream').
base_dir: the base directory for data files and logs
"""

backup = self.backup(username=username, xlog_method=xlog_method)
backup = self.backup(**kwargs)

# transform backup into a replica
return backup.spawn_replica(name=name, destroy=True)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp