Skip to content

Commit

Permalink
Added benchmarks and docs.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Oct 26, 2023
1 parent 701d3d1 commit 039d1cc
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `remote store` client APIs ([#552](https://github.com/opensearch-project/opensearch-py/pull/552))
- Added `nox -rs generate` ([#554](https://github.com/opensearch-project/opensearch-py/pull/554))
- Added a utf-8 header to all .py files ([#557](https://github.com/opensearch-project/opensearch-py/pull/557))
- Added `samples` to `nox -rs format` ([#556](https://github.com/opensearch-project/opensearch-py/pull/556))
- Added `samples`, `benchmarks` and `docs` to `nox -rs format` ([#556](https://github.com/opensearch-project/opensearch-py/pull/556))
### Changed
- Generate `tasks` client from API specs ([#508](https://github.com/opensearch-project/opensearch-py/pull/508))
- Generate `ingest` client from API specs ([#513](https://github.com/opensearch-project/opensearch-py/pull/513))
Expand Down
5 changes: 4 additions & 1 deletion benchmarks/bench_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.

import asyncio
import uuid
Expand All @@ -25,7 +28,7 @@ async def index_records(client, item_count):
client.index(
index=index_name,
body={
"title": f"Moneyball",
"title": "Moneyball",
"director": "Bennett Miller",
"year": "2011",
},
Expand Down
6 changes: 5 additions & 1 deletion benchmarks/bench_info_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.


import logging
import sys
Expand Down Expand Up @@ -36,7 +40,7 @@ def get_info(client, request_count):
tt = 0
for n in range(request_count):
start = time.time() * 1000
rc = client.info()
client.info()
total_time = time.time() * 1000 - start
tt += total_time
return tt
Expand Down
8 changes: 5 additions & 3 deletions benchmarks/bench_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.

import json
import logging
import sys
import time
import uuid

Expand All @@ -21,9 +26,6 @@
index_name = "test-index-sync"
item_count = 1000

import logging
import sys

root = logging.getLogger()
# root.setLevel(logging.DEBUG)
# logging.getLogger("urllib3.connectionpool").setLevel(logging.DEBUG)
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/bench_sync_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.


import bench_async
import bench_sync
Expand Down
6 changes: 4 additions & 2 deletions benchmarks/thread_with_return_value.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python

# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.


from threading import Thread

Expand Down
9 changes: 9 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
Expand Down
2 changes: 2 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"test_opensearchpy/",
"utils/",
"samples/",
"benchmarks/",
"docs/",
)


Expand Down

0 comments on commit 039d1cc

Please sign in to comment.