jina-ai / serve

☁️ Build multimodal AI applications with cloud-native stack
https://jina.ai/serve
Apache License 2.0
21.13k stars 2.22k forks source link

🚨 BREAKING CHANGES 0.9.0 -> 1.0.0 #1606

Closed nan-wang closed 3 years ago

nan-wang commented 3 years ago

This issue is created to keep track of breaking changes between 0.9.0 and 1.0.0 (scheduled release on Feb. 15, 2021)

Current version is PyPI

Breaking Changes & Migration Guide

PR Rolled Out? Override
#1722 yes #1739
#1739 yes
v0.9.0 v1.0.0
```python f = Flow().add(uses='NumpyIndexer', shards=2, separated_workspace=True) ``` ```python f = Flow().add(uses='NumpyIndexer', shards=2) # saved files # ├── jina.executors.indexers.vector.NumpyIndexer-86342edc-1 # │   ├── jina.executors.indexers.vector.NumpyIndexer-86342edc # │   └── jina.executors.indexers.vector.NumpyIndexer-86342edc.bin # └── jina.executors.indexers.vector.NumpyIndexer-c4f2ea6c-2 #    └── jina.executors.indexers.vector.NumpyIndexer-c4f2ea6c ```

PR Rolled Out? Override
#1632 yes
v0.9.0 v1.0.0
```python from jina.executors.crafters import BaseSegmenter class DummySentencizer(BaseSegmenter): def craft(self, text, *args, **kwargs): results = {} for t in text.split(','): results.append({'text': t}) return results return results ``` ```python from jina.executors.segmenters import BaseSegmenter class DummySentencizer(BaseSegmenter): def segment(self, text, *args, **kwargs): results = {} for t in text.split(','): results.append({'text': t}) return results return results ```

PR Rolled Out? Override
#1580 yes #1757
#1757 yes #1766
#1766 yes

PR Rolled Out? Override
#1677 yes #1764
#1764 yes
v0.9.0 v1.0.0
```python with Flow().add() as f: f.index([ Document(text='hello, jina') for _ in range(10)], batch_size=3) ``` ```python with Flow().add() as f: f.index([ Document(text='hello, jina') for _ in range(10)], request_size=3) ```

PR Rolled Out? Override
#1729 yes
v0.9.0 v1.0.0
```python f = (Flow() .add(uses='NumpyIndexer') .add(uses='MinRanker')) with f: f.search([Document(embedding=np.random.rand(10))]) ``` ```python f = (Flow() .add(uses='NumpyIndexer') .add(uses='SimpleAggregateRanker', aggregate_function='min', is_reversed_score=True)) with f: f.search([Document(embedding=np.random.rand(10))]) ```

PR Rolled Out? Override
#1730 yes

PR Rolled Out? Override
#1816 yes
v0.9.0 v1.0.0
```python async def input_fn(): for _ in range(10): yield Document() await asyncio.sleep(0.1) with AsyncFlow().add() as f: await f.index(input_fn) ``` ```python from jina import AsyncFlow async def input_fn(): for _ in range(10): yield Document() await asyncio.sleep(0.1) with AsyncFlow().add() as f: async for resp in f.index(input_fn): print(resp) ```

PR Rolled Out? Override
#1828 yes

PR Rolled Out? Override
#1823 yes
v0.9.0 v1.0.0
```python from jina import Flow f = Flow().add(uses='_index') with f: f.delete([Document(id=_id) for _id in ['🐦', '🐲']]) ``` ```python from jina import Flow f = Flow().add(uses='_index') with f: f.delete(['🐦', '🐲']) ```

PR Rolled Out? Override
#1831 yes

PR Rolled Out? Override
#1829 yes
v0.9.0 v1.0.0
```python vec_idx = array([0, 1]) with NumpyIndexer.load(save_abspath) as indexer: for idx in vec_idx: retrieved_vec = indexer.query_by_id(idx) ``` ```python vec_idx = array(['0', '1'], dtype=(np.str_, 16)) with NumpyIndexer.load(save_abspath) as indexer: for key in vec_idx: retrieved_vec = indexer.query_by_key(ke) ```

PR Rolled Out? Override
#1847 yes

PR Rolled Out? Override
#1858 yes

PR Rolled Out? Override
#1872 yes

Template

PR Rolled Out? Override
#1722 yes
v0.9.0 v1.0.0
```python old codes ``` ```python new codes ```

hanxiao commented 3 years ago

0.9.3->0.9.4 Changelog is lost due to a bug in release.sh, please use scripts/release.sh:L59 to retrieve it back

function make_release_note {
    ${RELEASENOTE} ${LAST_VER}..HEAD .github/release-template.ejs > ./CHANGELOG.tmp
    head -n10 ./CHANGELOG.tmp
    printf '\n%s\n\n%s\n%s\n\n%s\n\n%s\n\n' "$(cat ./CHANGELOG.md)" "<a name="release-note-${RELEASE_VER//\./-}"></a>" "## Release Note (\`${RELEASE_VER}\`)" "> Release time: $(date +'%Y-%m-%d %H:%M:%S')" "$(cat ./CHANGELOG.tmp)" > ./CHANGELOG.md
}
nan-wang commented 3 years ago

0.9.3->0.9.4 Changelog is lost due to a bug in release.sh, please use scripts/release.sh:L59 to retrieve it back

function make_release_note {
    ${RELEASENOTE} ${LAST_VER}..HEAD .github/release-template.ejs > ./CHANGELOG.tmp
    head -n10 ./CHANGELOG.tmp
    printf '\n%s\n\n%s\n%s\n\n%s\n\n%s\n\n' "$(cat ./CHANGELOG.md)" "<a name="release-note-${RELEASE_VER//\./-}"></a>" "## Release Note (\`${RELEASE_VER}\`)" "> Release time: $(date +'%Y-%m-%d %H:%M:%S')" "$(cat ./CHANGELOG.tmp)" > ./CHANGELOG.md
}

@hanxiao fixed in https://github.com/jina-ai/jina/pull/1645

florian-hoenicke commented 3 years ago

The attribute separated_workspace will be removed. The pea will always have it's own workspace in case pea_id >0 Also the pea_workspace meta will not exist anymore. https://github.com/jina-ai/jina/pull/1722