Skip to content

Commit 8fba9e4

Browse files
author
Joan Fontanals
authored
feat: remove JAC (docarray#1791)
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
1 parent d0b9990 commit 8fba9e4

File tree

13 files changed

+14
-794
lines changed

13 files changed

+14
-794
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -138,58 +138,6 @@ jobs:
138138
flags: ${{ steps.test.outputs.codecov_flag }}
139139
fail_ci_if_error: false
140140

141-
142-
143-
docarray-test-jac:
144-
needs: [import-test]
145-
runs-on: ubuntu-latest
146-
strategy:
147-
fail-fast: false
148-
matrix:
149-
python-version: [3.8]
150-
pydantic-version: ["pydantic-v2", "pydantic-v1"]
151-
steps:
152-
- uses: actions/checkout@v2.5.0
153-
- name: Set up Python ${{ matrix.python-version }}
154-
uses: actions/setup-python@v4
155-
with:
156-
python-version: ${{ matrix.python-version }}
157-
- name: Prepare environment
158-
run: |
159-
python -m pip install --upgrade pip
160-
python -m pip install poetry
161-
poetry install --all-extras
162-
./scripts/install_pydantic_v2.sh ${{ matrix.pydantic-version }}
163-
poetry run pip install elasticsearch==8.6.2
164-
poetry run pip uninstall -y torch
165-
poetry run pip install torch
166-
sudo apt-get update
167-
sudo apt-get install --no-install-recommends ffmpeg
168-
169-
- name: Test
170-
id: test
171-
run: |
172-
poetry run pytest -m "not (tensorflow or benchmark or index or jax)" --cov=docarray --cov-report=xml tests/integrations/store/test_jac.py
173-
echo "flag it as docarray for codeoverage"
174-
echo "codecov_flag=docarray" >> $GITHUB_OUTPUT
175-
timeout-minutes: 30
176-
env:
177-
JINA_AUTH_TOKEN: "${{ secrets.JINA_AUTH_TOKEN }}"
178-
- name: Check codecov file
179-
id: check_files
180-
uses: andstor/file-existence-action@v1
181-
with:
182-
files: "coverage.xml"
183-
- name: Upload coverage from test to Codecov
184-
uses: codecov/codecov-action@v3.1.1
185-
if: steps.check_files.outputs.files_exists == 'true' && ${{ matrix.python-version }} == '3.8'
186-
with:
187-
file: coverage.xml
188-
name: benchmark-test-codecov
189-
flags: ${{ steps.test.outputs.codecov_flag }}
190-
fail_ci_if_error: false
191-
192-
193141
docarray-test-proto3:
194142
needs: [import-test]
195143
runs-on: ubuntu-latest

docarray/array/doc_list/pushpull.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Dict,
66
Iterable,
77
Iterator,
8-
Optional,
98
Tuple,
109
Type,
1110
TypeVar,
@@ -15,7 +14,7 @@
1514
from typing_extensions import Literal
1615
from typing_inspect import get_args
1716

18-
PUSH_PULL_PROTOCOL = Literal['jac', 's3', 'file']
17+
PUSH_PULL_PROTOCOL = Literal['s3', 'file']
1918
SUPPORTED_PUSH_PULL_PROTOCOLS = get_args(PUSH_PULL_PROTOCOL)
2019

2120
if TYPE_CHECKING: # pragma: no cover
@@ -55,18 +54,13 @@ def get_pushpull_backend(
5554
"""
5655
Get the backend for the given protocol.
5756
58-
:param protocol: the protocol to use, e.g. 'jac', 'file', 's3'
57+
:param protocol: the protocol to use, e.g. 'file', 's3'
5958
:return: the backend class
6059
"""
6160
if protocol in cls.__backends__:
6261
return cls.__backends__[protocol]
6362

64-
if protocol == 'jac':
65-
from docarray.store.jac import JACDocStore
66-
67-
cls.__backends__[protocol] = JACDocStore
68-
logging.debug('Loaded Jina AI Cloud backend')
69-
elif protocol == 'file':
63+
if protocol == 'file':
7064
from docarray.store.file import FileDocStore
7165

7266
cls.__backends__[protocol] = FileDocStore
@@ -84,46 +78,36 @@ def get_pushpull_backend(
8478
def push(
8579
self,
8680
url: str,
87-
public: bool = True,
8881
show_progress: bool = False,
89-
branding: Optional[Dict] = None,
82+
**kwargs,
9083
) -> Dict:
9184
"""Push this `DocList` object to the specified url.
9285
9386
:param url: url specifying the protocol and save name of the `DocList`. Should be of the form ``protocol://namespace/name``. e.g. ``s3://bucket/path/to/namespace/name``, ``file:///path/to/folder/name``
94-
:param public: Only used by ``jac`` protocol. If true, anyone can pull a `DocList` if they know its name.
95-
Setting this to false will restrict access to only the creator.
9687
:param show_progress: If true, a progress bar will be displayed.
97-
:param branding: Only used by ``jac`` protocol. A dictionary of branding information to be sent to Jina AI Cloud. {"icon": "emoji", "background": "#fff"}
9888
"""
9989
logging.info(f'Pushing {len(self)} docs to {url}')
10090
protocol, name = self.__class__.resolve_url(url)
10191
return self.__class__.get_pushpull_backend(protocol).push(
102-
self, name, public, show_progress, branding # type: ignore
92+
self, name, show_progress # type: ignore
10393
)
10494

10595
@classmethod
10696
def push_stream(
10797
cls: Type[SelfPushPullMixin],
10898
docs: Iterator['BaseDoc'],
10999
url: str,
110-
public: bool = True,
111100
show_progress: bool = False,
112-
branding: Optional[Dict] = None,
113101
) -> Dict:
114102
"""Push a stream of documents to the specified url.
115103
116104
:param docs: a stream of documents
117105
:param url: url specifying the protocol and save name of the `DocList`. Should be of the form ``protocol://namespace/name``. e.g. ``s3://bucket/path/to/namespace/name``, ``file:///path/to/folder/name``
118-
:param public: Only used by ``jac`` protocol. If true, anyone can pull a `DocList` if they know its name.
119106
:param show_progress: If true, a progress bar will be displayed.
120-
:param branding: Only used by ``jac`` protocol. A dictionary of branding information to be sent to Jina AI Cloud. {"icon": "emoji", "background": "#fff"}
121107
"""
122108
logging.info(f'Pushing stream to {url}')
123109
protocol, name = cls.resolve_url(url)
124-
return cls.get_pushpull_backend(protocol).push_stream(
125-
docs, name, public, show_progress, branding
126-
)
110+
return cls.get_pushpull_backend(protocol).push_stream(docs, name, show_progress)
127111

128112
@classmethod
129113
def pull(

docarray/store/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@
88
)
99

1010
if TYPE_CHECKING:
11-
from docarray.store.jac import JACDocStore # noqa: F401
1211
from docarray.store.s3 import S3DocStore # noqa: F401
1312

1413
__all__ = ['FileDocStore']
1514

1615

1716
def __getattr__(name: str):
1817
lib: types.ModuleType
19-
if name == 'JACDocStore':
20-
import_library('hubble', raise_error=True)
21-
import docarray.store.jac as lib
22-
elif name == 'S3DocStore':
18+
if name == 'S3DocStore':
2319
import_library('smart_open', raise_error=True)
2420
import_library('botocore', raise_error=True)
2521
import_library('boto3', raise_error=True)

docarray/store/abstract_doc_store.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from abc import ABC, abstractmethod
2-
from typing import Dict, Iterator, List, Optional, Type
2+
from typing import Dict, Iterator, List, Type
33

44
from typing_extensions import TYPE_CHECKING
55

@@ -35,17 +35,13 @@ def delete(name: str, missing_ok: bool) -> bool:
3535
def push(
3636
docs: 'DocList',
3737
name: str,
38-
public: bool,
3938
show_progress: bool,
40-
branding: Optional[Dict],
4139
) -> Dict:
4240
"""Push this DocList to the specified name.
4341
4442
:param docs: The DocList to push
4543
:param name: The name to push to
46-
:param public: Whether the DocList should be publicly accessible
4744
:param show_progress: If true, a progress bar will be displayed.
48-
:param branding: Branding information to be stored with the DocList
4945
"""
5046
...
5147

@@ -54,17 +50,13 @@ def push(
5450
def push_stream(
5551
docs: Iterator['BaseDoc'],
5652
url: str,
57-
public: bool = True,
5853
show_progress: bool = False,
59-
branding: Optional[Dict] = None,
6054
) -> Dict:
6155
"""Push a stream of documents to the specified name.
6256
6357
:param docs: a stream of documents
6458
:param url: The name to push to
65-
:param public: Whether the DocList should be publicly accessible
6659
:param show_progress: If true, a progress bar will be displayed.
67-
:param branding: Branding information to be stored with the DocList
6860
"""
6961
...
7062

docarray/store/file.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
from pathlib import Path
3-
from typing import Dict, Iterator, List, Optional, Type, TypeVar
3+
from typing import Dict, Iterator, List, Type, TypeVar
44

55
from typing_extensions import TYPE_CHECKING
66

@@ -98,40 +98,29 @@ def push(
9898
cls: Type[SelfFileDocStore],
9999
docs: 'DocList',
100100
name: str,
101-
public: bool,
102101
show_progress: bool,
103-
branding: Optional[Dict],
104102
) -> Dict:
105103
"""Push this [`DocList`][docarray.DocList] object to the specified file path.
106104
107105
:param docs: The `DocList` to push.
108106
:param name: The file path to push to.
109-
:param public: Not used by the ``file`` protocol.
110107
:param show_progress: If true, a progress bar will be displayed.
111-
:param branding: Not used by the ``file`` protocol.
112108
"""
113-
return cls.push_stream(iter(docs), name, public, show_progress, branding)
109+
return cls.push_stream(iter(docs), name, show_progress)
114110

115111
@classmethod
116112
def push_stream(
117113
cls: Type[SelfFileDocStore],
118114
docs: Iterator['BaseDoc'],
119115
name: str,
120-
public: bool = True,
121116
show_progress: bool = False,
122-
branding: Optional[Dict] = None,
123117
) -> Dict:
124118
"""Push a stream of documents to the specified file path.
125119
126120
:param docs: a stream of documents
127121
:param name: The file path to push to.
128-
:param public: Not used by the ``file`` protocol.
129122
:param show_progress: If true, a progress bar will be displayed.
130-
:param branding: Not used by the ``file`` protocol.
131123
"""
132-
if branding is not None:
133-
logging.warning('branding is not supported for "file" protocol')
134-
135124
source = _to_binary_stream(
136125
docs, protocol='protobuf', compress='gzip', show_progress=show_progress
137126
)

0 commit comments

Comments
 (0)