From 3618a45f6c8ab329cf6c538b9054d4300bfacf89 Mon Sep 17 00:00:00 2001 From: Han Xiao Date: Thu, 20 Jan 2022 06:53:10 +0100 Subject: [PATCH 1/2] fix(array): move hubble url to inline --- docarray/array/mixins/io/pushpull.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docarray/array/mixins/io/pushpull.py b/docarray/array/mixins/io/pushpull.py index 86ff23e56e8..cd118e9c651 100644 --- a/docarray/array/mixins/io/pushpull.py +++ b/docarray/array/mixins/io/pushpull.py @@ -36,7 +36,6 @@ def _get_cloud_api() -> str: class PushPullMixin: """Transmitting :class:`DocumentArray` via Jina Cloud Service""" - _service_url = _get_cloud_api() + '/v2/rpc/da.' _max_bytes = 4 * 1024 * 1024 * 1024 def push(self, token: str, show_progress: bool = False) -> None: @@ -86,7 +85,8 @@ def read(self, n=-1): with progress as p_bar: body = BufferReader(data, p_bar, task_id) - requests.post(self._service_url + 'push', data=body, headers=headers) + _service_url = _get_cloud_api() + '/v2/rpc/da.' + requests.post(_service_url + 'push', data=body, headers=headers) @classmethod def pull( @@ -102,7 +102,8 @@ def pull( """ import requests - url = f'{cls._service_url}pull?token={token}' + _service_url = _get_cloud_api() + '/v2/rpc/da.' + url = f'{_service_url}pull?token={token}' response = requests.get(url) progress = _get_progressbar(show_progress) From 7b3d501d540db6e5d243b03be447ce9579e77b42 Mon Sep 17 00:00:00 2001 From: Han Xiao Date: Thu, 20 Jan 2022 06:55:05 +0100 Subject: [PATCH 2/2] fix(array): move hubble url to inline --- docarray/array/mixins/io/pushpull.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docarray/array/mixins/io/pushpull.py b/docarray/array/mixins/io/pushpull.py index cd118e9c651..4461bffee3b 100644 --- a/docarray/array/mixins/io/pushpull.py +++ b/docarray/array/mixins/io/pushpull.py @@ -85,8 +85,9 @@ def read(self, n=-1): with progress as p_bar: body = BufferReader(data, p_bar, task_id) - _service_url = _get_cloud_api() + '/v2/rpc/da.' - requests.post(_service_url + 'push', data=body, headers=headers) + requests.post( + f'{_get_cloud_api()}/v2/rpc/da.push', data=body, headers=headers + ) @classmethod def pull( @@ -102,8 +103,7 @@ def pull( """ import requests - _service_url = _get_cloud_api() + '/v2/rpc/da.' - url = f'{_service_url}pull?token={token}' + url = f'{_get_cloud_api()}/v2/rpc/da.pull?token={token}' response = requests.get(url) progress = _get_progressbar(show_progress)