diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f798aae20b3a4..805582199bfb3 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -402,7 +402,7 @@ jobs: python -m cibuildwheel --output-dir dist - name: Upload wheels as artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: path: dist/*.whl diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eadcc74874aed..be1a07813463d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v2.5.0 with: fetch-depth: 0 - - uses: wagoid/commitlint-github-action@v4 + - uses: wagoid/commitlint-github-action@v3 lint-flake-8: runs-on: ubuntu-latest @@ -691,7 +691,7 @@ jobs: python -m cibuildwheel --output-dir dist - name: Upload wheels as artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: path: dist/*.whl diff --git a/.github/workflows/force-release.yml b/.github/workflows/force-release.yml index 52c0a25f724c6..358dc39e88918 100644 --- a/.github/workflows/force-release.yml +++ b/.github/workflows/force-release.yml @@ -142,7 +142,7 @@ jobs: python -m cibuildwheel --output-dir dist - name: Upload wheels as artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: path: dist/*.whl diff --git a/jina/clients/base/helper.py b/jina/clients/base/helper.py index 1e869c2599c7c..620513ceec460 100644 --- a/jina/clients/base/helper.py +++ b/jina/clients/base/helper.py @@ -178,8 +178,9 @@ async def send_message(self, request: 'Request'): r_str = await response.json() except aiohttp.ContentTypeError: r_str = await response.text() + r_status = response.status handle_response_status(response.status, r_str, self.url) - return response + return r_status, r_str except (ValueError, ConnectionError, BadClient, aiohttp.ClientError, aiohttp.ClientConnectionError) as err: self.logger.debug(f'Got an error: {err} sending POST to {self.url} in attempt {attempt}/{self.max_attempts}') await retry.wait_or_raise_err( diff --git a/jina/clients/base/http.py b/jina/clients/base/http.py index c55156bf69365..746bdf0e0acfd 100644 --- a/jina/clients/base/http.py +++ b/jina/clients/base/http.py @@ -193,9 +193,7 @@ def _result_handler(result): async for response in streamer.stream( request_iterator=request_iterator, results_in_order=results_in_order ): - r_status = response.status - - r_str = await response.json() + r_status, r_str = response handle_response_status(r_status, r_str, url) da = None diff --git a/tests/unit/clients/test_helper.py b/tests/unit/clients/test_helper.py index b723a65acaaae..66ae0d9081f38 100644 --- a/tests/unit/clients/test_helper.py +++ b/tests/unit/clients/test_helper.py @@ -37,8 +37,8 @@ async def test_http_clientlet(): ) as iolet: request = _new_data_request('/', None, {'a': 'b'}) assert request.header.target_executor == '' - r = await iolet.send_message(request) - response = DataRequest(await r.json()) + r_status, r_json = await iolet.send_message(request) + response = DataRequest(r_json) assert response.header.exec_endpoint == '/' assert response.parameters == {'a': 'b'} @@ -55,7 +55,8 @@ async def test_http_clientlet_target(): request = _new_data_request('/', 'nothing', {'a': 'b'}) assert request.header.target_executor == 'nothing' r = await iolet.send_message(request) - response = DataRequest(await r.json()) + r_status, r_json = r + response = DataRequest(r_json) assert response.header.exec_endpoint == '/' assert response.parameters == {'a': 'b'}