From e79dd7d3111433bfe8c6a73ddb25866537f29503 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:14:22 +0400 Subject: [PATCH] [Backport 8.16] Build dists as part of CI (#2710) Co-authored-by: Quentin Pradet --- .github/workflows/ci.yml | 25 ++++++++++++++++++++----- elasticsearch/_otel.py | 2 +- elasticsearch/_sync/client/utils.py | 3 +-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d7b8ecfd..52298bd59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,17 +8,32 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.x - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.x" - name: Install dependencies run: | python3 -m pip install nox - name: Lint the code run: nox -s lint + package: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Set up Python 3.x + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python3 -m pip install build + - name: Build dists + run: python utils/build-dists.py + test-linux: strategy: fail-fast: false @@ -32,9 +47,9 @@ jobs: continue-on-error: false steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set Up Python - ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install Dependencies diff --git a/elasticsearch/_otel.py b/elasticsearch/_otel.py index 4bb57dae7..f37ca24cd 100644 --- a/elasticsearch/_otel.py +++ b/elasticsearch/_otel.py @@ -102,7 +102,7 @@ def helpers_span(self, span_name: str) -> Generator[OpenTelemetrySpan, None, Non @contextlib.contextmanager def use_span(self, span: OpenTelemetrySpan) -> Generator[None, None, None]: - if not self.enabled or self.tracer is None: + if not self.enabled or self.tracer is None or span.otel_span is None: yield return diff --git a/elasticsearch/_sync/client/utils.py b/elasticsearch/_sync/client/utils.py index 959f61bfd..c5ec21dae 100644 --- a/elasticsearch/_sync/client/utils.py +++ b/elasticsearch/_sync/client/utils.py @@ -56,10 +56,9 @@ url_to_node_config, ) -from elasticsearch.exceptions import GeneralAvailabilityWarning - from ..._version import __versionstr__ from ...compat import to_bytes, to_str, warn_stacklevel +from ...exceptions import GeneralAvailabilityWarning if TYPE_CHECKING: from ._base import NamespacedClient