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

Commit8a25cb3

Browse files
authored
Add pgbench_with_wait function (#122)
1 parent0cf30a7 commit8a25cb3

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

‎testgres/node.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ def pgbench(self,
13711371
username=None,
13721372
stdout=None,
13731373
stderr=None,
1374-
options=[]):
1374+
options=None):
13751375
"""
13761376
Spawn a pgbench process.
13771377
@@ -1385,6 +1385,8 @@ def pgbench(self,
13851385
Returns:
13861386
Process created by subprocess.Popen.
13871387
"""
1388+
ifoptionsisNone:
1389+
options= []
13881390

13891391
# Set default arguments
13901392
dbname=dbnameordefault_dbname()
@@ -1404,6 +1406,29 @@ def pgbench(self,
14041406

14051407
returnproc
14061408

1409+
defpgbench_with_wait(self,
1410+
dbname=None,
1411+
username=None,
1412+
stdout=None,
1413+
stderr=None,
1414+
options=None):
1415+
"""
1416+
Do pgbench command and wait.
1417+
1418+
Args:
1419+
dbname: database name to connect to.
1420+
username: database user name.
1421+
stdout: stdout file to be used by Popen.
1422+
stderr: stderr file to be used by Popen.
1423+
options: additional options for pgbench (list).
1424+
"""
1425+
ifoptionsisNone:
1426+
options= []
1427+
1428+
withself.pgbench(dbname,username,stdout,stderr,options)aspgbench:
1429+
pgbench.wait()
1430+
return
1431+
14071432
defpgbench_init(self,**kwargs):
14081433
"""
14091434
Small wrapper for pgbench_run().

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp