Content-Length: 316347 | pFad | http://github.com/postgrespro/testgres/pull/15/files

11 Add pgbench init and pgbench command for node. by stalkerg · Pull Request #15 · postgrespro/testgres · GitHub
Skip to content

Add pgbench init and pgbench command for node. #15

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 12, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
setup(
name='testgres',
packages=['testgres'],
version='0.1.16',
version='0.1.17',
description='Testing utility for postgresql and its extensions',
author='Ildar Musin',
author_email='zildermann@gmail.com',
Expand Down
36 changes: 36 additions & 0 deletions testgres/testgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,42 @@ def backup(self, name):

return backup_path

def pgbench_init(self, dbname='postgres', scale=1, options=[]):
"""Prepare pgbench database"""
pgbench = self.get_bin_path("pgbench")
params = [
pgbench,
"-i",
"-s", "%i" % scale,
"-p", "%i" % self.port
] + options + [dbname]
with open(self.output_filename, "a") as file_out, \
open(self.error_filename, "a") as file_err:
ret = subprocess.call(
params,
stdout=file_out,
stderr=file_err
)
if ret:
raise ClusterException("pgbench init failed")

return True

def pgbench(self, dbname='postgres', stdout=None, stderr=None, options=[]):
"""Make pgbench process"""
pgbench = self.get_bin_path("pgbench")
params = [
pgbench,
"-p", "%i" % self.port
] + options + [dbname]
proc = subprocess.Popen(
params,
stdout=stdout,
stderr=stderr
)

return proc

def connect(self, dbname='postgres', username=None):
return NodeConnection(parent_node=self, dbname=dbname, user=username)

Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/testgres/pull/15/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy