Jina Versions Save

☁️ Build multimodal AI applications with cloud-native stack

v3.20.0

9 months ago

Release Note (3.20.0)

Release time: 2023-08-04 08:58:38 This release contains 5 new features 3 bug fixes and 8 documentation improvements.

🆕 Features

Executor can work on single documents (#5991)

Executors no longer need to work solely on a DocList, but can expose endpoints for working on single documents.

For this, the method decorated by requests must take a doc argument and an annotation for the input and output types.

from jina import Executor, requests
from docarray import BaseDoc

class MyInputDocument(BaseDoc):
    num: int

class MyOutputDocument(BaseDoc):
    label: str

class MyExecutor(Executor):
    @requests(on='/hello')
    async def task(self, doc: MyInputDocument, **kwargs) -> MyOutputDocument:
        return MyOutputDocument(label='even' if doc.num % 2 == 0 else 'odd')

This keeps Executor code clean, especially for serving models that can't benefit from working on batches of documents at the same time.

Parameters can be described as Pydantic models (#6001)

An Executor's parameters argument can now be a Pydantic model rather than a plain Python dictionary. To use a Pydantic model, the parameters argument needs to have the model as a type annotation.

Defining parameters as a Pydantic model instead of a simple Dict has two main benefits:

  • Validation and default values: You can get validation of the parameters that the Executor expected before the Executor may access any invalid key. You can also easily define defaults.
  • Descriptive OpenAPI definition when using the HTTP protocol.

Expose richer OpenAPI when serving Executor with HTTP inside a Flow (#5992)

Executors served with Deployments and Flows can now provide a descriptive OpenAPI when using HTTP. The description, examples and other relevant fields are used in the Gateway to provide a complete API.

Support streaming in single-Executor Flows (#5988)

Streaming endpoints now also support the Flow orchestration layer and it is no longer mandatory to use just a Deployment. A Flow orchestration can accept streaming endpoints under both the gRPC and HTTP protocols.

with Flow(protocol=protocol, port=port, cors=True).add(
    uses=StreamingExecutor,
):
    client = Client(port=port, protocol=protocol, asyncio=True)
    i = 10
    async for doc in client.stream_doc(
            on='/hello',
            inputs=MyDocument(text='hello world', number=i),
            return_type=MyDocument,
    ):
        print(doc)

Streaming endpoints with gRPC protocol (#5921)

After adding SSE support to allow streaming documents one by one for the HTTP protocol, we added the same functionality for the gRPC protocol. A Jina server can now stream single Documents to a client, one at a time, using gRPC. This feature relies on streaming gRPC endpoints under the hood.

One typical use-case of this feature is streaming tokens from a Large Language Model. For instance, check our how-to on streaming LLM tokens.

from jina import Executor, requests, Deployment
from docarray import BaseDoc

# first define schemas
class MyDocument(BaseDoc):
    text: str

# then define the Executor
class MyExecutor(Executor):

    @requests(on='/hello')
    async def task(self, doc: MyDocument, **kwargs) -> MyDocument:
        for i in range(100):
            yield MyDocument(text=f'hello world {i}')
            
with Deployment(
    uses=MyExecutor,
    port=12345,
    protocol='grpc', # or 'http'
) as dep:
    dep.block()

From the client side, you can use the new stream_doc() method to receive documents one by one:

from jina import Client, Document

client = Client(port=12345, protocol='grpc', asyncio=True)
async for doc in client.stream_doc(
    on='/hello', inputs=MyDocument(text='hello world'), return_type=MyDocument
):
    print(doc.text)

Read more in the docs.

🐞 Bug Fixes

Fix caching models from all endpoints, inputs and outputs (#6005)

An issue was fixed that caused problems when using an Executor inside a Flow where the same document type was used as input and output in different endpoints.

Use 127.0.0.1 as local ctrl address (#6004)

The orchestration layer will use 127.0.0.1 to send health checks to Executors and Gateways when working locally. It previously used 0.0.0.0 as the default host and this caused issues in some configurations.

Ignore warnings from Google (#5968)

Warnings that used to appear in relation to the pkg_resources deprecated API are now suppressed.

📗 Documentation Improvements

  • Fix errors in getting started and preliminaries (#6008)
  • Add note about Flow with one Executor supported (#5990)
  • Add docs for secrets and jobs (#5948)
  • Remove include gateway arg (#5987)
  • Add Kubernetes hint to port ignore (#5985)
  • Add docs for streaming (#5980)
  • Add docs for jcloud horizontal pod autoscale (#5957)
  • Update docs to show single document serving (#6009)

🤟 Contributors

We would like to thank all contributors to this release:

  • Joan Fontanals (@JoanFM)
  • Nikolas Pitsillos (@npitsillos)
  • Alex Cureton-Griffiths (@alexcg1)
  • Deepankar Mahapatro (@deepankarm)
  • Winston Wong (@winstonww)
  • AlaeddineAbdessalem (@alaeddine-13)
  • Zhaofeng Miao (@mapleeit)

v3.19.1

10 months ago

Release Note (3.19.1)

Release time: 2023-07-19 07:54:28

This release contains 5 bug fixes.

🐞 Bug Fixes

Dynamic batching with docarray>=0.30 (#5970)

Dynamic batching requests for Executors were not working when using docarray>=0.30.0. This fix makes this feature fully compatible with newer versions of DocArray.

Monitoring validation error with docarray>=0.30 (#5965)

When using docarray>=0.30 in combination with monitoring, there was a risk of getting a validation error because the input and output schemas were not properly considered.

Fail fast when no valid schemas (#5962)

When no valid schemas were used, Executors sometimes failed to load, but the Gateway would continue to try getting the endpoints from them until it timed out. Now, everything will stop faster without the long wait.

Properly handle multiprotocol Deployments to Kubernetes (#5961)

When converting a Deployment using multiple protocols to Kubernetes YAML, the resulting services did not use or expose the ports and protocols as expected. This has now been fixed.

Fix gRPC connectivity issues for health check (#5972)

Fixed issues for Flow not being able to health-check Executors due to HTTP proxy used.

Now this is changed, and when doing:

from jina import Deployment

d = Deployment(protocol=['grpc', 'http'])
d.to_kubernetes_yaml('./k8s-deployment')

You will get a YAML where the two services expose each protocol.

🤟 Contributors

We would like to thank all contributors to this release:

  • Joan Fontanals (@JoanFM)

v3.19.0

10 months ago

Release Note (3.19.0)

Release time: 2023-07-10 09:01:16

This release contains 3 new features, 4 bug fixes, and 3 documentation improvements.

🆕 Features

Jina is now compatible with all versions of DocArray. Unpin version in requirements (#5941)

Jina is now fully compatible with docarray>=0.30, which uncaps the version requirement.

By default, Jina will install the latest DocArray version, however, it remains compatible with the older version. If you still want to use the old version and syntax, manually install docarray<0.30 or pin the requirement in your project.

from docarray import BaseDoc, DocList
from jina import Deployment, Executor, requests


class MyDoc(BaseDoc):
    text: str


class MyExec(Executor):
    @requests(on='/foo')
    def foo(self, docs: DocList[MyDoc], **kwargs):
        docs[0].text = 'hello world'


with Deployment().add(uses=MyExec) as d:
    docs = d.post(on='/foo', inputs=MyDoc(text='hello'), return_type=DocList[MyDoc])
    assert docs[0].text == 'hello world'

Use dynamic gateway Hubble image (#5935)

In order to make Flow compatible with both docarray>=0.30 and docarray<0.30 versions, Hubble provides utilities to adapt the jina and docarray versions to the user's system. This also requires that the gateway image used in K8s be rebuilt. To do this, we have created a Hubble image that dynamically adapts to the system's docarray version. This was necessary to provide support for all DocArray versions.

Add ìmage_pull_secrets argument to Flow to enable pulling from private registry in Kubernetes (#5952)

In order for Kubernetes to pull docker images from a private registry, users need to create secrets that are passed to the Deployments as ImagePullSecrets .

Jina now provides an image_pull_secrets argument for Deployments and Flows which will make sure that those secrets are used by Kubernetes after applying to_kubernetes_yaml

from jina import Flow

f = Flow(image_pull_secrets=['regcred']).add()
f.to_kubernetes_yaml(...)

🐞 Bug Fixes

Fix validation with default endpoint (#5956)

When using docarray>=0.30. Gateway would not start because an Executor binding to the /default endpoint was connected to another that did not bind to this special endpoint. It considered this to be an incompatible topology.

We have solved this problem and this is now possible:

from jina import Flow, Executor, requests


class Encoder(Executor):
    @requests
    def encode(**kwargs):
        pass


class Indexer(Executor):
    @requests('/index')
    def index(**kwargs):
        pass

    @requests('/search')
    def search(**kwargs):
        pass


f = Flow().add(uses=Encoder).add(uses=Indexer)

with f:
    f.block()

Apply return_type when return_responses=True (#5949)

When calling client.post with arguments return_type and return_responses=True, the return_type parameter was not properly applied. This is now fixed and when accessing the docs of the Response they will have the expected type.

from jina import Executor, Deployment, requests
from docarray import DocList, BaseDoc


class InputDoc(BaseDoc):
    text: str


class OutputDoc(BaseDoc):
    len: int


class LenExecutor(Executor):
    @requests
    def foo(self, docs: DocList[InputDoc], **kwargs) -> DocList[OutputDoc]:
        ret = DocList[OutputDoc]()
        for doc in docs:
            ret.append(OutputDoc(len=len(doc.text)))
        return ret


d = Deployment(uses=LenExecutor)

with d:
    resp = d.post(
        "/",
        inputs=InputDoc(text="five"),
        return_type=DocList[OutputDoc],
        return_responses=True,
    )
    assert isinstance(resp[0].docs[0], OutputDoc)

Fix generator detection (#5947)

Jina wrongly tagged async methods as generators which should be used for single Document streaming. Now this is fixed and async methods can safely be used in Executors with docarray>=0.30.

Fix Flow.plot method (#5934)

The plot method for Flow was producing the broken URL https://mermaid.ink/. This has now been fixed.

📗 Documentation Improvements

  • adapt documentation to focus on new DocArray (#5941)
  • Text not tags in code snippets (#5930)
  • Changes for the links and hugging face model name (#5955)

🤟 Contributors

We would like to thank all contributors to this release:

  • Alex Cureton-Griffiths (@alexcg1 )
  • Joan Fontanals (@JoanFM )
  • Han Xiao (@hanxiao )
  • Emre Demir (@emreds )

v3.18.0

11 months ago

Release Note (3.18.0)

Release time: 2023-06-22 13:32:50

This release contains 2 new features, 4 bug fixes, and 2 documentation improvements.

🆕 Features

Streaming single Document with HTTP SSE for Deployment (#5899)

In this release, we have added support for Server-Sent Events (SSE) to Jina's HTTP protocol with the Deployment orchestration. A Jina server can now stream single Documents to a client, one at a time. This is useful for applications that require a continuous stream of data, such as chatbots (using Large Language Models) or real-time translation.

Simply define an endpoint function that receives a single Document and yields Documents one by one:

from jina import Executor, requests, Document, Deployment

class MyExecutor(Executor):
    @requests(on='/hello')
    async def task(self, doc: Document, **kwargs):
        for i in range(3):
            yield Document(text=f'{doc.text} {i}')
            
with Deployment(
    uses=MyExecutor,
    port=12345,
    protocol='http',
    cors=True,
    include_gateway=False,
) as dep:
    dep.block()

From the client side, you can use the new stream_doc method to receive the Documents one by one:

from jina import Client, Document

client = Client(port=12345, protocol='http', cors=True, asyncio=True)
async for doc in client.stream_doc(
    on='/hello', inputs=Document(text='hello world')
):
    print(doc.text)

Note that the SSE client is language-independent. This feature also supports DocArray v2. For more information, see the streaming endpoints section of the Jina documentation.

Add env_from_secret option to Gateway (#5914)

We have added the env_from_secret parameter to Gateway to allow custom gateways to load secrets from Kubernetes when transformed to Kubernetes YAML in the same way as Executors.

from jina import Flow

f = Flow().config_gateway(env_from_secret={'SECRET_PASSWORD': {'name': 'mysecret', 'key': 'password'}}).add()
f.to_kubernetes_yaml()

🐞 Bug Fixes

Fix error working with some data types in DocArray V2 (#5905) (#5908)

We have fixed some errors when DocArray v2 documents contained flexible dictionaries, Lists, or Tensors.

Fix reloading Executor when is loaded from config.yml (#5915)

The reload option of an Executor was not working when the Executor was loaded from config.yml, and Jina was not able to update Executor code after updates.

f = Flow().add(uses='config.yml', reload=True)
with f:
    f.block()

Ensure closing Executor at shutdown in Deployment with HTTP protocol (#5906)

We have fixed a bug that prevented the close method of the Executor from being executed at shutdown when the Deployment is exposed with an HTTP server.

Fix issue in mismatch endpoint when using shards (#5904)

A KeyError was raised when working with DocArray v2 in a Deployment using shards if the endpoints were not matching. With this fix, it will properly call the default endpoint.

from jina import Deployment, Executor, requests
from docarray import BaseDoc, DocList
from docarray.typing import NdArray
fromt typing import List

class MyDoc(BaseDoc):
    text: str
    embedding: NdArray[128]

class MyDocWithMatchesAndScores(MyDoc):
    matches: DocList[MyDoc]
    scores: List[float]

class MyExec(Executor):

    @requests
    def foo(self, docs: DocList[MyDoc], **kwargs) -> DocList[MyDocWithMatchesAndScores]:
        res = DocList[MyDocWithMatchesAndScores]()
        for doc in docs:
            new_doc = MyDocWithMatchesAndScores(text=doc.text, embedding=doc.embedding, matches=docs,
                                                scores=[1.0 for _ in docs])
            res.append(new_doc)
        return res

d = Deployment(uses=MyExec, shards=2)
with d:
    res = d.post(on='/', inputs=DocList[MyDoc]([MyDoc(text='hey ha', embedding=np.random.rand(128))]))
    assert len(res) == 1

📗 Documentation Improvements

  • README revamp to put more emphasis on generative AI use cases (#5895)
  • Fix links in docs (#5909)

🤟 Contributors

We would like to thank all contributors to this release:

  • Alex Cureton-Griffiths (@alexcg1 )
  • AlaeddineAbdessalem (@alaeddine-13)
  • Joan Fontanals (@JoanFM )

v3.17.0

11 months ago

Release Note (3.17.0)

Release time: 2023-06-06 15:25:15

This release contains 1 new feature and 1 bug fix.

🆕 Features

Flows now compatible with DocArray v2 (#5861)

Finally, Flows and Deployments are fully compatible with the new DocArray version (above 0.30.0). This includes all supported protocols and features, namely http, grpc and websocket for Flow and http and grpc for Deployment.

Now you can enjoy the capacity and expressivity of the new DocArray together with the performance, scalability and richness of Jina.

from docarray import BaseDoc, DocList
from jina import Flow, Executor, requests

class MyDoc(BaseDoc):
    text: str

class MyExec(Executor):
    @requests(on='/foo')
    def foo(self, docs: DocList[MyDoc], **kwargs):
        docs[0].text = 'hello world'

ports=[12345, 12346]
protocols=['http, 'grpc']
with Flow(protocol=protocols, ports=ports).add(uses=MyExec):
    for port, protocol in zip(ports, protocols):
        c = Client(port=port, protocol=protocol)
        docs = c.post(on='/foo', inputs=MyDoc(text='hello'), return_type=DocList[MyDoc])
        assert docs[0].text == 'hello world'

While Jina is fully compatible with the new DocArray version, for now it will not install the latest version, since there remain compatibility issues with Hubble and JCloud. As soon as these are resolved, Jina will install the new version by default.

🐞 Bug Fixes

Fix instantiation of Executor with write decorator (#5897)

Fix instantiation of Executors where the first method is decorated with a @write decorator.

from jina import Executor, requests
from jina.serve.executors.decorators import write

class WriteExecutor(Executor):
    @write
    @requests(on='/delete')
    def delete(self, **kwargs):
        pass

    @requests(on='/bar')
    @write
    def bar(self, **kwargs):
        pass

🤟 Contributors

We would like to thank all contributors to this release:

  • Joan Fontanals (@JoanFM )

v3.16.1

1 year ago

Release Note (3.16.1)

Release time: 2023-05-23 14:59:35

This patch contains 1 refactoring, 3 bug fixes and 3 documentation improvements.

⚙ Refactoring

Remove aiostream dependency (#5891)

Remove aiostream dependency which could be the root of improper licensing.

🐞 Bug Fixes

Fix usage of ports and protocols alias (#5885)

You can now use plural ports and protocols:

from jina import Flow

f = Flow(ports=[12345, 12346], protocols=['grpc', 'http']).add()

with f:
    f.block()

Previously, the arguments would correctly be applied to the inner Deployments.

Fix endpoint printing (#5884)

Fix endpoint printing when no ports are specified with multi-protocol Deployments:

from jina import Deployment, Executor, requests, Client

d = Deployment(protocols=['grpc', 'http'])

with d:
    pass

Before: image

After:

image

Fix the printed links to docs and redocs pages when HTTP protocol is used in combination with other protocols.

from jina import Deployment, Executor, requests, Client
d = Deployment(protocol=['grpc', 'http'], port=[12345, 12346])
with d:
    pass

Old behavior:

image

New behavior:

image

📗 Documentation Improvements

  • Fix import in notebook causing a crash (#5888)
  • Add docs for Jina Cloud logs (#5892)
  • Fix YAML specs links (#5887)

🤟 Contributors

We would like to thank all contributors to this release:

  • Joan Fontanals (@JoanFM)
  • Han Xiao (@hanxiao )
  • Alex Cureton-Griffiths (@alexcg1)
  • Nikolas Pitsillos (@npitsillos )

v3.16.0

1 year ago

Release Note (3.16.0)

Release time: 2023-05-05 06:35:58

This release contains 4 new features, 5 bug fixes and 8 documentation improvements.

🆕 Features

(Beta) Replicate with consensus stateful Executors using RAFT algorithm with new DocArray version (docarray >= 0.30) (#5564)

When scaling Executors inside a Deployment, you can now ensure internal state (if the Executor has one) can be synced across every replica by ensuring they all work in consensus. This means the internal state of every replica will be consistent and they can thus serve requests in an equivalent manner.

For this, you need to decorate the Executor methods that alter its inner state with the @write decorator. Then, when adding the Executor inside a Deployment, you need to add the stateful=True flag and optionally configure the ports of every peer in the replication cluster using the --peer-ports argument:

from jina import Deployment, Executor, requests
from jina.serve.executors.decorators import write
from docarray import DocList
from docarray.documents import TextDoc

class MyStateStatefulExecutor(Executor):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._docs_dict = {}
     
    @write
    @requests(on=['/index'])
    def index(self, docs: DocList[TextDoc], **kwargs) -> DocList[TextDoc]:
        for doc in docs:
            self._docs_dict[doc.id] = doc
    
    @requests(on=['/search'])
    def search(self,  docs: DocList[TextDoc], **kwargs) -> DocList[TextDoc]:
        for doc in docs:
            self.logger.debug(f'Searching against {len(self._docs_dict)} documents')
            doc.text = self._docs_dict[doc.id].text

d = Deployment(name='stateful_executor', 
               uses=MyStateStatefulExecutor,
               replicas=3, 
               stateful=True, 
               peer_ports=[12345, 12346, 12347])
with d:
    d.block()

The consensus module in Jina will ensure that the three replicas all hold the same state. Jina uses the RAFT algorithm (https://raft.github.io/) to provide this feature.

Support HTTP and combined protocols for Deployment with new DocArray version (docarray >= 0.30) (#5826)

You can now use the new DocArray version when using HTTP as protocol to serve a Deployment, or a composition of HTTP and gRPC.

This allows OpenAPI specs matching the exact Document schemas defined by the Executor:

from jina import Executor, requests
from docarray import DocList, BaseDoc
from docarray.documents import ImageDoc
from docarray.typing import AnyTensor

import numpy as np

class InputDoc(BaseDoc):
    img: ImageDoc

class OutputDoc(BaseDoc):
    embedding: AnyTensor

class MyExec(Executor):
    @requests(on='/bar')
    def bar(
            self, docs: DocList[InputDoc], **kwargs
    ) -> DocList[OutputDoc]:
        docs_return = DocList[OutputDoc](
            [OutputDoc(embedding=np.zeros((100, 1))) for _ in range(len(docs))]
        )
        return docs_return

d = Deployment(uses=MyExec, protocol='http')

with d:
    d.block()

Screenshot from 2023-05-02 13-26-37

Support sharding in Deployment with new DocArray version (docarray >= 0.30) (#5828)

Using shards inside a Deployment (where the Executor works with docarray>=0.30) will now work the same as with previous versions of docarray as described in the documentation.

When starting a Flow or a Deployment with the HTTP protocol, the /docs and /redocs links will now appear complete and can be clicked to open the browser directly from the terminal.

Previously, you would see: image

Now: image

🐞 Bug Fixes

Improved platform-specific dependency for uvloop. (#5841)

Fix installation issues when downstream dependencies try to install Jina on Windows using poetry.

Use utf-8 encoding when opening files (#5821)

Use utf-8 encoding when opening files to fix potential problems when using Jina in Windows.

Fix new Deployment CLI (#5819)

Fix the output YAML file when using jina new <project-name> --type deployment. It previously dumped an invalid Deployment YAML. The syntax has now been fixed so that it can be deployed.

Use container stop so that containers running cuda can be killed (#5816)

Use stop instead of kill from the Python Docker SDK. This allows containerized Executors that are run with conda run to terminate, since conda does not propagate its captured signals to its Python subprocesses.

Catch ContentTypeError for retry in post requests (#5825)

ContentTypeError responses in the Client will now be caught and retries applied if required.

📗 Documentation Improvements

  • Update Slack count (#5842)
  • Add storage section (#5831)
  • Remove layer from orchestration layer title (#5829)
  • Fix broken links (#5822)
  • Add docs for jc recreate (#5815)
  • Point to legacy DocumentArray docs (#5810)
  • Fix some English in docstrings (#5718)
  • Fix some links in scalability chapter (#5809)

🤟 Contributors

We would like to thank all contributors to this release:

  • notandor (@NotAndOr )
  • Deepankar Mahapatro (@deepankarm )
  • Alex Cureton-Griffiths (@alexcg1 )
  • Tanguy Abel (@Tanguyabel )
  • Nikolas Pitsillos (@npitsillos )
  • Felix Mönckemeyer (@NemesisFLX)
  • Joan Fontanals (@JoanFM)
  • Florian Hönicke (@florian-hoenicke )

v3.15.4

1 year ago

Release Note (3.15.2)

Release time: 2023-05-05 06:35:58

🙇 We'd like to thank all contributors for this new release! In particular, Joan Fontanals, notandor, Deepankar Mahapatro, Nikolas Pitsillos, Tanguy Abel, Florian Hönicke, Alex Cureton-Griffiths, Felix Mönckemeyer, Jina Dev Bot, 🙇

🆕 New Features

  • [6ba33fe0] - catch ContentTypeError for retry in POST requests (#5825) (Tanguy Abel)
  • [9f317c58] - add support to HTTP and Composite Deployment with docarray v2 (#5826) (Joan Fontanals)

🐞 Bug fixes

  • [bf536eb8] - set platform specific dependency to uvloop in a better way. (#5841) (notandor)
  • [9b784b9e] - fix HTTP support for Deployment and docarray v2 (#5830) (Joan Fontanals)
  • [d57679a0] - use always utf-8 encoding when opening files(#5821) (Florian Hönicke)
  • [779bff28] - fix new CLI for Deployment (#5819) (Joan Fontanals)
  • [034ee847] - use container STOP so that containers running CUDA can be killed (#5816) (Joan Fontanals)
  • [90b46ade] - docstrings-english (#5718) (Alex Cureton-Griffiths)
  • [d6636eb9] - link issues in scalability chapter (#5809) (Felix Mönckemeyer)

📗 Documentation

  • [8fda71bf] - update slack count (#5842) (Deepankar Mahapatro)
  • [ecd86056] - jcloud: add storage section (#5831) (Nikolas Pitsillos)
  • [5080dacc] - remove layer from orchestration layer title (#5829) (Joan Fontanals)
  • [d45f4b3d] - fix broken links (#5822) (Joan Fontanals)
  • [b3590006] - add docs for jc recreate (#5815) (Nikolas Pitsillos)
  • [12948a86] - point to legacy documentarray docs (#5810) (Joan Fontanals)

🏁 Unit Test and CICD

  • [c2d52cdd] - fix some tests in CI (#5812) (Joan Fontanals)
  • [892a2825] - fix docarray v2 comp tests (#5811) (Joan Fontanals)

🍹 Other Improvements

  • [3adc08eb] - bump jina version (#5849) (Joan Fontanals)
  • [a5d3403d] - pin urllib3 (#5848) (Joan Fontanals)
  • [de9fcc92] - fix links in README (#5846) (Joan Fontanals)
  • [729d4d49] - fix link to survey (#5844) (Joan Fontanals)
  • [75f0269e] - try to fix CI (#5814) (Joan Fontanals)
  • [c596452c] - ignore dynamically generated protobuf docs (#5726) (Alex Cureton-Griffiths)
  • [7a1c1e4a] - docs: update TOC (Jina Dev Bot)
  • [b3493635] - version: the next version will be 3.15.1 (Jina Dev Bot)

v3.15.2

1 year ago

Release Note (3.15.2)

Release time: 2023-05-05 06:35:58

🙇 We'd like to thank all contributors for this new release! In particular, Joan Fontanals, notandor, Deepankar Mahapatro, Nikolas Pitsillos, Tanguy Abel, Florian Hönicke, Alex Cureton-Griffiths, Felix Mönckemeyer, Jina Dev Bot, 🙇

🆕 New Features

  • [6ba33fe0] - catch ContentTypeError for retry in POST requests (#5825) (Tanguy Abel)
  • [9f317c58] - add support to HTTP and Composite Deployment with docarray v2 (#5826) (Joan Fontanals)

🐞 Bug fixes

  • [bf536eb8] - set platform specific dependency to uvloop in a better way. (#5841) (notandor)
  • [9b784b9e] - fix HTTP support for Deployment and docarray v2 (#5830) (Joan Fontanals)
  • [d57679a0] - use always utf-8 encoding when opening files(#5821) (Florian Hönicke)
  • [779bff28] - fix new CLI for Deployment (#5819) (Joan Fontanals)
  • [034ee847] - use container STOP so that containers running CUDA can be killed (#5816) (Joan Fontanals)
  • [90b46ade] - docstrings-english (#5718) (Alex Cureton-Griffiths)
  • [d6636eb9] - link issues in scalability chapter (#5809) (Felix Mönckemeyer)

📗 Documentation

  • [8fda71bf] - update slack count (#5842) (Deepankar Mahapatro)
  • [ecd86056] - jcloud: add storage section (#5831) (Nikolas Pitsillos)
  • [5080dacc] - remove layer from orchestration layer title (#5829) (Joan Fontanals)
  • [d45f4b3d] - fix broken links (#5822) (Joan Fontanals)
  • [b3590006] - add docs for jc recreate (#5815) (Nikolas Pitsillos)
  • [12948a86] - point to legacy documentarray docs (#5810) (Joan Fontanals)

🏁 Unit Test and CICD

  • [c2d52cdd] - fix some tests in CI (#5812) (Joan Fontanals)
  • [892a2825] - fix docarray v2 comp tests (#5811) (Joan Fontanals)

🍹 Other Improvements

  • [3adc08eb] - bump jina version (#5849) (Joan Fontanals)
  • [a5d3403d] - pin urllib3 (#5848) (Joan Fontanals)
  • [de9fcc92] - fix links in README (#5846) (Joan Fontanals)
  • [729d4d49] - fix link to survey (#5844) (Joan Fontanals)
  • [75f0269e] - try to fix CI (#5814) (Joan Fontanals)
  • [c596452c] - ignore dynamically generated protobuf docs (#5726) (Alex Cureton-Griffiths)
  • [7a1c1e4a] - docs: update TOC (Jina Dev Bot)
  • [b3493635] - version: the next version will be 3.15.1 (Jina Dev Bot)

v3.15.0

1 year ago

Release Note (3.15.0)

Release time: 2023-04-14 09:55:25

This release contains 6 new features, 6 bug fixes and 5 documentation improvements.

🆕 Features

HTTP and composite protocols for Deployment (#5764)

When using a Deployment to serve a single Executor, you can now expose it via HTTP or a combination of HTTP and gRPC protocols:

from jina import Deployment, Executor, requests

class MyExec(Executor):

    @requests(on='/bar')
    def bar(self, docs, **kwargs):
        pass

dep = Deployment(protocol=['http', 'grpc'], port=[12345, 12346], uses=MyExec)

with dep:
    dep.block()

With this, you can also access the OpenAPI schema in localhost:12345/docs:

http-swagger-ui

Force network mode option (#5789)

When using a containerized Executor inside a Deployment or as part of a Flow, under some circumstances you may want to force the network mode to make sure the container is reachable by the Flow or Deployment to ensure readiness. This ensures that the Docker Python SDK runs the container with the relevant options.

For this, we have added the argument force_network_mode to enable this.

You can set this argument to any of these options:

  • AUTO: Automatically detect the Docker network.
  • HOST: Use the host network.
  • BRIDGE: Use a user-defined bridge network.
  • NONE: Use None as the network.
from jina import Deployment

dep = Deployment(uses='jinaai+docker://TransformerTorchEncoder', force_network_mode='None')
with dep:
    dep.block()

Allow disabling thread lock (#5771)

When an Executor exposes a synchronous method (not a coroutine) and exposes this method via the @requests decorator, Jina makes sure that each request received is run in a thread.

This thread is however locked with a threading.Lock object to protect the user from potential hazards of multithreading while leaving the Executor free to respond to health checks coming from the outside or from orchestrator frameworks such as Kubernetes. This lock can be bypassed if the allow_concurrent argument is passed to the Executor.

from jina import Deployment, Executor, requests

class MyExec(Executor):

    @requests(on='/bar')
    def bar(self, docs, **kwargs):
        pass

dep = Deployment(allow_concurrent=True, uses=MyExec)

with dep:
    dep.block()

grpc_channel_options for custom gRPC options for the channel (#5765)

You can now pass grpc_channel_options to allow granular tuning of the gRPC connectivity from the Client or Gateway. You can check the options in gRPC Python documentation

client = Client(grpc_channel_options={'grpc.max_send_message_length': -1})

Create Deployments from the CLI (#5756)

New you can create from the Jina CLI to create a first project to deploy a single Deployment in the same way it was possible to create one for a Flow.

Now the jina new command accepts a new type argument that can be flow or deployment.

jina new hello-world --type flow
jina new hello-world --type deployment

Add replicas argument to Gateway for Kubernetes (#5711)

To scale the Gateway in Kubernetes or in JCloud, you can now add the replicas arguments to the gateway.

from jina import Flow
f = Flow().config_gateway(replicas=3).add()
f.to_kubernetes_yaml('./k8s_yaml_path')
jtype: Flow
version: '1'
with: {}
gateway:
  replicas: 3
executors:
- name: executor0

🐞 Bug Fixes

Retry client gRPC stream and unary RPC methods (#5733)

The retry mechanism parameters were not properly respected by the Client in prior releases. This is now fixed and will improve the robustness against transient errors.

from jina import Client, DocumentArray

Client(host='...').post(
    on='/',
    inputs=DocumentArray.empty(),
    max_attempts=100,
)

Allow HTTP timeout (#5797)

When using the Client to send data to an HTTP service, the connection timed out after five minutes (the default setting for aiohttp). This can now be edited for cases where a request may take longer, thus avoiding the Client disconnecting after a longer period.

from jina import Client, DocumentArray

Client(protocol='http').post(
    on='/',
    inputs=DocumentArray.empty(),
    timeout=600,
)

Enable root logging at all times (#5736)

The JINA_LOG_LEVEL environment variable controls the log level of the JinaLogger. Previously the debug logging of other dependencies was not respected. Now they can be enabled.

logging.get_logger('urllib3').setLevel(logging.DEBUG)

Fix Gateway tensor serialization (#5752)

In prior releases, when an HTTP Gateway was run without torch installed and connected to an Executor returning torch.Tensor as part of the Documents, the Gateway couldn't serialize the Documents back to the Client, leading to a no module torch error. This is now fixed and works without installing torch in the Gateway container or system.

from jina import Flow, Executor, Document, DocumentArray, requests

import torch

class DummyTorchExecutor(Executor):
    @requests
    def foo(self, docs: DocumentArray, **kwargs):
        for d in docs:
            d.embedding = torch.rand(1000)
            d.tensor = torch.rand(1000)
from jina import Flow, Executor, Document, DocumentArray, requests

flow = Flow().config_gateway(port=12346, protocol='http').add(port='12345', external=True)

with flow:
    docs = flow.post(on='/', inputs=Document())
    print(docs[0].embedding.shape)
    print(docs[0].tensor.shape)

Composite Gateway tracing (#5741)

Previously, tracing didn't work for Gateways that exposed multiple protocols:

from jina import Flow

f = Flow(port=[12345, 12346], protocol=['http', 'grpc'], tracing=True).add()
with f:
   f.block()

Adapt to DocArray v2 (#5742)

Jina depends on DocArray's data structures. This version adds support for DocArray v2's upcoming major changes.

The involves naming conventions:

  • DocumentArray :arrow_right: DocList
  • BaseDocument :arrow_right: BaseDoc
from jina import Deployment, Executor, requests
from docarray import DocList, BaseDoc
from docarray.documents import ImageDoc
from docarray.typing import AnyTensor

import numpy as np

class InputDoc(BaseDoc):
    img: ImageDoc

class OutputDoc(BaseDoc):
    embedding: AnyTensor

class MyExec(Executor):
    @requests(on='/bar')
    def bar(
        self, docs: DocList[InputDoc], **kwargs
    ) -> DocumentArray[OutputDoc]:
        docs_return = DocList[OutputDoc](
            [OutputDoc(embedding=np.zeros((100, 1))) for _ in range(len(docs))]
        )
        return docs_return

with Deployment(uses=MyExec) as dep:
    docs = dep.post(
        on='/bar',
        inputs=InputDoc(img=ImageDoc(tensor=np.zeros((3, 224, 224)))),
        return_type=DocList[OutputDoc],
    )
    assert docs[0].embedding.shape == (100, 1)
    assert docs.__class__.document_type == OutputDoc

📗 Documentation improvements

  • JCloud Flow name customization (#5778)
  • JCloud docs revamp for instance (#5759)
  • Fix Colab link (#5760)
  • Remove docsQA (#5743)
  • Misc polishing

🤟 Contributors

We would like to thank all contributors to this release:

  • Girish Chandrashekar (@girishc13)
  • Asuzu Kosisochukwu (@asuzukosi)
  • AlaeddineAbdessalem (@alaeddine-13)
  • Zac Li (@zac-li)
  • nikitashrivastava29 (@nikitashrivastava29)
  • samsja (@samsja)
  • Alex Cureton-Griffiths (@alexcg1)
  • Joan Fontanals (@JoanFM)
  • Deepankar Mahapatro (@deepankarm)