Skip to content

Commit 900ea94

Browse files
authored
Incorporated API generation into CI workflow and fixed 'generate' nox session (opensearch-project#660)
Signed-off-by: saimedhi <saimedhi@amazon.com>
1 parent 6e58837 commit 900ea94

File tree

11 files changed

+164
-10
lines changed

11 files changed

+164
-10
lines changed

.github/workflows/ci.yml

+15
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ jobs:
1818
python3.7 -m pip install nox
1919
- name: Lint the code
2020
run: nox -s lint
21+
22+
generate:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v3
27+
- name: Set up Python 3.7
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: 3.7
31+
- name: Install dependencies
32+
run: |
33+
python3.7 -m pip install nox
34+
- name: Run the api generator
35+
run: nox -s generate
2136

2237
test-build-distribution:
2338
runs-on: ubuntu-latest

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
88
- Added pylint `pointless-statement` ([#611](https://github.com/opensearch-project/opensearch-py/pull/611))
99
- Added a log collection guide ([#579](https://github.com/opensearch-project/opensearch-py/pull/579))
1010
- Added GHA release ([#614](https://github.com/opensearch-project/opensearch-py/pull/614))
11+
- Incorporated API generation into CI workflow and fixed 'generate' nox session ([#660](https://github.com/opensearch-project/opensearch-py/pull/660))
1112
### Changed
1213
- Updated the `get_policy` API in the index_management plugin to allow the policy_id argument as optional ([#633](https://github.com/opensearch-project/opensearch-py/pull/633))
1314
### Deprecated

noxfile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def format(session: Any) -> None:
7474
session.run("black", *SOURCE_FILES)
7575
session.run("python", "utils/license_headers.py", "fix", *SOURCE_FILES)
7676

77-
lint(session)
77+
session.notify("lint")
7878

7979

8080
@nox.session(python=["3.7"]) # type: ignore
@@ -146,4 +146,4 @@ def generate(session: Any) -> None:
146146
"""
147147
session.install("-rdev-requirements.txt")
148148
session.run("python", "utils/generate_api.py")
149-
format(session)
149+
session.notify("format")

opensearchpy/_async/client/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,7 @@ async def scroll(
16101610
"rest_total_hits_as_int",
16111611
"routing",
16121612
"scroll",
1613+
"search_pipeline",
16131614
"search_type",
16141615
"seq_no_primary_term",
16151616
"size",
@@ -1704,6 +1705,8 @@ async def search(
17041705
:arg routing: Comma-separated list of specific routing values.
17051706
:arg scroll: Specify how long a consistent view of the index
17061707
should be maintained for scrolled search.
1708+
:arg search_pipeline: Customizable sequence of processing stages
1709+
applied to search queries.
17071710
:arg search_type: Search operation type. Valid choices are
17081711
query_then_fetch, dfs_query_then_fetch.
17091712
:arg seq_no_primary_term: Specify whether to return sequence

opensearchpy/_async/client/cat.py

+37-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ async def aliases(
7070
"GET", _make_path("_cat", "aliases", name), params=params, headers=headers
7171
)
7272

73-
@query_params()
73+
@query_params("bytes", "format", "h", "help", "s", "v")
7474
async def all_pit_segments(
7575
self,
7676
params: Any = None,
@@ -79,6 +79,16 @@ async def all_pit_segments(
7979
"""
8080
Lists all active point-in-time segments.
8181
82+
83+
:arg bytes: The unit in which to display byte values. Valid
84+
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
85+
:arg format: A short version of the Accept header, e.g. json,
86+
yaml.
87+
:arg h: Comma-separated list of column names to display.
88+
:arg help: Return help information. Default is false.
89+
:arg s: Comma-separated list of column names or column aliases
90+
to sort by.
91+
:arg v: Verbose mode. Display column headers. Default is false.
8292
"""
8393
return await self.transport.perform_request(
8494
"GET", "/_cat/pit_segments/_all", params=params, headers=headers
@@ -503,7 +513,7 @@ async def pending_tasks(
503513
"GET", "/_cat/pending_tasks", params=params, headers=headers
504514
)
505515

506-
@query_params()
516+
@query_params("bytes", "format", "h", "help", "s", "v")
507517
async def pit_segments(
508518
self,
509519
body: Any = None,
@@ -514,6 +524,15 @@ async def pit_segments(
514524
List segments for one or several PITs.
515525
516526
527+
:arg bytes: The unit in which to display byte values. Valid
528+
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
529+
:arg format: A short version of the Accept header, e.g. json,
530+
yaml.
531+
:arg h: Comma-separated list of column names to display.
532+
:arg help: Return help information. Default is false.
533+
:arg s: Comma-separated list of column names or column aliases
534+
to sort by.
535+
:arg v: Verbose mode. Display column headers. Default is false.
517536
"""
518537
return await self.transport.perform_request(
519538
"GET", "/_cat/pit_segments", params=params, headers=headers, body=body
@@ -632,15 +651,20 @@ async def repositories(
632651

633652
@query_params(
634653
"active_only",
654+
"allow_no_indices",
635655
"bytes",
636656
"completed_only",
637657
"detailed",
658+
"expand_wildcards",
638659
"format",
639660
"h",
640661
"help",
662+
"ignore_throttled",
663+
"ignore_unavailable",
641664
"s",
642665
"shards",
643666
"time",
667+
"timeout",
644668
"v",
645669
)
646670
async def segment_replication(
@@ -658,21 +682,32 @@ async def segment_replication(
658682
names to limit the returned information.
659683
:arg active_only: If `true`, the response only includes ongoing
660684
segment replication events. Default is false.
685+
:arg allow_no_indices: Whether to ignore if a wildcard indices
686+
expression resolves into no concrete indices. (This includes `_all`
687+
string or when no indices have been specified).
661688
:arg bytes: The unit in which to display byte values. Valid
662689
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
663690
:arg completed_only: If `true`, the response only includes
664691
latest completed segment replication events. Default is false.
665692
:arg detailed: If `true`, the response includes detailed
666693
information about segment replications. Default is false.
694+
:arg expand_wildcards: Whether to expand wildcard expression to
695+
concrete indices that are open, closed or both. Valid choices are all,
696+
open, closed, hidden, none.
667697
:arg format: A short version of the Accept header, e.g. json,
668698
yaml.
669699
:arg h: Comma-separated list of column names to display.
670700
:arg help: Return help information. Default is false.
701+
:arg ignore_throttled: Whether specified concrete, expanded or
702+
aliased indices should be ignored when throttled.
703+
:arg ignore_unavailable: Whether specified concrete indices
704+
should be ignored when unavailable (missing or closed).
671705
:arg s: Comma-separated list of column names or column aliases
672706
to sort by.
673707
:arg shards: Comma-separated list of shards to display.
674708
:arg time: The unit in which to display time values. Valid
675709
choices are d, h, m, s, ms, micros, nanos.
710+
:arg timeout: Operation timeout.
676711
:arg v: Verbose mode. Display column headers. Default is false.
677712
"""
678713
return await self.transport.perform_request(

opensearchpy/_async/client/indices.py

+31-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ async def create(
166166
)
167167

168168
@query_params(
169-
"cluster_manager_timeout", "master_timeout", "timeout", "wait_for_active_shards"
169+
"cluster_manager_timeout",
170+
"master_timeout",
171+
"task_execution_timeout",
172+
"timeout",
173+
"wait_for_active_shards",
174+
"wait_for_completion",
170175
)
171176
async def clone(
172177
self,
@@ -189,9 +194,13 @@ async def clone(
189194
:arg master_timeout (Deprecated: To promote inclusive language,
190195
use 'cluster_manager_timeout' instead.): Operation timeout for
191196
connection to master node.
197+
:arg task_execution_timeout: Explicit task execution timeout,
198+
only useful when wait_for_completion is false, defaults to 1h.
192199
:arg timeout: Operation timeout.
193200
:arg wait_for_active_shards: Set the number of active shards to
194201
wait for on the cloned index before the operation returns.
202+
:arg wait_for_completion: Should this request wait until the
203+
operation has completed before returning. Default is True.
195204
"""
196205
for param in (index, target):
197206
if param in SKIP_IN_PATH:
@@ -260,8 +269,10 @@ async def get(
260269
"expand_wildcards",
261270
"ignore_unavailable",
262271
"master_timeout",
272+
"task_execution_timeout",
263273
"timeout",
264274
"wait_for_active_shards",
275+
"wait_for_completion",
265276
)
266277
async def open(
267278
self,
@@ -287,9 +298,13 @@ async def open(
287298
:arg master_timeout (Deprecated: To promote inclusive language,
288299
use 'cluster_manager_timeout' instead.): Operation timeout for
289300
connection to master node.
301+
:arg task_execution_timeout: Explicit task execution timeout,
302+
only useful when wait_for_completion is false, defaults to 1h.
290303
:arg timeout: Operation timeout.
291304
:arg wait_for_active_shards: Sets the number of active shards to
292305
wait for before the operation returns.
306+
:arg wait_for_completion: Should this request wait until the
307+
operation has completed before returning. Default is True.
293308
"""
294309
if index in SKIP_IN_PATH:
295310
raise ValueError("Empty value passed for a required argument 'index'.")
@@ -1245,6 +1260,7 @@ async def shard_stores(
12451260
"ignore_unavailable",
12461261
"max_num_segments",
12471262
"only_expunge_deletes",
1263+
"wait_for_completion",
12481264
)
12491265
async def forcemerge(
12501266
self,
@@ -1272,6 +1288,8 @@ async def forcemerge(
12721288
be merged into (default: dynamic).
12731289
:arg only_expunge_deletes: Specify whether the operation should
12741290
only expunge deleted documents.
1291+
:arg wait_for_completion: Should this request wait until the
1292+
operation has completed before returning. Default is True.
12751293
"""
12761294
return await self.transport.perform_request(
12771295
"POST", _make_path(index, "_forcemerge"), params=params, headers=headers
@@ -1281,8 +1299,10 @@ async def forcemerge(
12811299
"cluster_manager_timeout",
12821300
"copy_settings",
12831301
"master_timeout",
1302+
"task_execution_timeout",
12841303
"timeout",
12851304
"wait_for_active_shards",
1305+
"wait_for_completion",
12861306
)
12871307
async def shrink(
12881308
self,
@@ -1307,9 +1327,13 @@ async def shrink(
13071327
:arg master_timeout (Deprecated: To promote inclusive language,
13081328
use 'cluster_manager_timeout' instead.): Operation timeout for
13091329
connection to master node.
1330+
:arg task_execution_timeout: Explicit task execution timeout,
1331+
only useful when wait_for_completion is false, defaults to 1h.
13101332
:arg timeout: Operation timeout.
13111333
:arg wait_for_active_shards: Set the number of active shards to
13121334
wait for on the shrunken index before the operation returns.
1335+
:arg wait_for_completion: Should this request wait until the
1336+
operation has completed before returning. Default is True.
13131337
"""
13141338
for param in (index, target):
13151339
if param in SKIP_IN_PATH:
@@ -1327,8 +1351,10 @@ async def shrink(
13271351
"cluster_manager_timeout",
13281352
"copy_settings",
13291353
"master_timeout",
1354+
"task_execution_timeout",
13301355
"timeout",
13311356
"wait_for_active_shards",
1357+
"wait_for_completion",
13321358
)
13331359
async def split(
13341360
self,
@@ -1354,9 +1380,13 @@ async def split(
13541380
:arg master_timeout (Deprecated: To promote inclusive language,
13551381
use 'cluster_manager_timeout' instead.): Operation timeout for
13561382
connection to master node.
1383+
:arg task_execution_timeout: Explicit task execution timeout,
1384+
only useful when wait_for_completion is false, defaults to 1h.
13571385
:arg timeout: Operation timeout.
13581386
:arg wait_for_active_shards: Set the number of active shards to
13591387
wait for on the shrunken index before the operation returns.
1388+
:arg wait_for_completion: Should this request wait until the
1389+
operation has completed before returning. Default is True.
13601390
"""
13611391
for param in (index, target):
13621392
if param in SKIP_IN_PATH:

opensearchpy/_async/client/nodes.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ async def stats(
122122
nodes.
123123
:arg metric: Limit the information returned to the specified
124124
metrics. Valid choices are _all, breaker, fs, http, indices, jvm, os,
125-
process, thread_pool, transport, discovery, indexing_pressure.
125+
process, thread_pool, transport, discovery, indexing_pressure,
126+
search_pipeline.
126127
:arg index_metric: Limit the information returned for `indices`
127128
metric to the specific index metrics. Isn't used if `indices` (or `all`)
128129
metric isn't specified. Valid choices are _all, store, indexing, get,

opensearchpy/client/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,7 @@ def scroll(
16101610
"rest_total_hits_as_int",
16111611
"routing",
16121612
"scroll",
1613+
"search_pipeline",
16131614
"search_type",
16141615
"seq_no_primary_term",
16151616
"size",
@@ -1704,6 +1705,8 @@ def search(
17041705
:arg routing: Comma-separated list of specific routing values.
17051706
:arg scroll: Specify how long a consistent view of the index
17061707
should be maintained for scrolled search.
1708+
:arg search_pipeline: Customizable sequence of processing stages
1709+
applied to search queries.
17071710
:arg search_type: Search operation type. Valid choices are
17081711
query_then_fetch, dfs_query_then_fetch.
17091712
:arg seq_no_primary_term: Specify whether to return sequence

0 commit comments

Comments
 (0)