Skip to content

Commit

Permalink
Add compatibility with argh 0.30.1+
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed Oct 24, 2023
1 parent fcd8161 commit 9dc83d5
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion cr8/insert_fake_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ async def _gen_data_and_insert(q, e, client, stmt, row_fun, size_seq):
type=argparse.FileType('r'),
help='JSON file with a column to fake provider mapping.')
@argh.wrap_errors([KeyboardInterrupt] + clients.client_errors)
def insert_fake_data(hosts=None,
def insert_fake_data(*,
hosts=None,
table=None,
num_records=1e5,
bulk_size=1000,
Expand Down
3 changes: 2 additions & 1 deletion cr8/insert_from_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ async def async_insert_from_sql(src_uri,
@argh.arg('-c', '--concurrency', type=to_int)
@argh.arg('-of', '--output-fmt', choices=['json', 'text'], default='text')
@argh.wrap_errors([KeyboardInterrupt, BrokenPipeError] + clients.client_errors)
def insert_from_sql(src_uri=None,
def insert_from_sql(*,
src_uri=None,
query=None,
fetch_size=100,
concurrency=25,
Expand Down
3 changes: 2 additions & 1 deletion cr8/insert_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def print_only(lines, table):
@argh.arg('-i', '--infile', type=FileType('r', encoding='utf-8'), default=sys.stdin)
@argh.arg('-of', '--output-fmt', choices=['json', 'text'], default='text')
@argh.wrap_errors([KeyboardInterrupt, BrokenPipeError] + clients.client_errors)
def insert_json(table=None,
def insert_json(*,
table=None,
bulk_size=1000,
concurrency=25,
hosts=None,
Expand Down
2 changes: 1 addition & 1 deletion cr8/reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async def _async_reindex(client):


@argh.arg('--hosts', help='crate hosts', type=str, required=True)
def reindex(hosts=None):
def reindex(*, hosts=None):
with clients.client(hosts) as client:
run(_async_reindex, client)

Expand Down
1 change: 1 addition & 0 deletions cr8/run_crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ def create_node(
@argh.wrap_errors([ArgumentError])
def run_crate(
version,
*,
env=None,
setting=None,
crate_root=None,
Expand Down
2 changes: 1 addition & 1 deletion cr8/run_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ def do_run_spec(spec,
executor.exec_instructions(spec.teardown)


@argh.arg('benchmark_hosts', type=str)
@argh.arg('-r', '--result_hosts', type=str)
@argh.arg('-of', '--output-fmt', choices=['json', 'text'], default='text')
@argh.arg('--action',
Expand All @@ -287,6 +286,7 @@ def do_run_spec(spec,
@argh.wrap_errors([KeyboardInterrupt, BrokenPipeError] + clients.client_errors)
def run_spec(spec,
benchmark_hosts,
*,
result_hosts=None,
output_fmt=None,
logfile_info=None,
Expand Down
1 change: 1 addition & 0 deletions cr8/run_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def execute(self, track):
help='Method used for sampling', default='reservoir')
@argh.wrap_errors([KeyboardInterrupt, BrokenPipeError] + client_errors)
def run_track(track,
*,
result_hosts=None,
crate_root=None,
output_fmt=None,
Expand Down
3 changes: 2 additions & 1 deletion cr8/timeit.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
@argh.arg('--sample-mode', choices=('all', 'reservoir'),
help='Method used for sampling', default='reservoir')
@argh.wrap_errors([KeyboardInterrupt, BrokenPipeError] + client_errors)
def timeit(hosts=None,
def timeit(*,
hosts=None,
stmt=None,
warmup=30,
repeat=None,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_reindex(self):
)
self._to_stop.append(crate_v4)
crate_v4.start()
reindex(crate_v4.http_url)
reindex(hosts=crate_v4.http_url)
with client(crate_v4.http_url) as c:
result = aio.run(c.execute, "SELECT version FROM information_schema.tables WHERE table_name = 't'")
version = result['rows'][0][0]
Expand Down

0 comments on commit 9dc83d5

Please sign in to comment.