Highlights π
Floating Executor π
You can add floating Executors in your Flow. This way of adding Executors in a Flow can be used for asynchronous backround tasks that are not needed for the response of the service you are building.
f = Flow().add().add(needs=['gateway'],floating=True)
Parameter per Executor π
You can send specific parameters to each Executor by using the executorname__paramname
syntax. The Executor named executorname
will receive the parameter paramname
(without the executorname__
in the key name) and none of the other Executors will receive it.
from jina import Flow, DocumentArray
with Flow().add(name='exec1').add(name='exec2') as flow:
flow.index(
DocumentArray.empty(size=5),
parameters={'exec1__traversal_path': '@r', 'exec2__traversal_path': '@c'},
)
Map multiple Executor endpoints to the same method πΊοΈ
Now you can dynamically map different endpoints to the same Executor.
from jina import Flow, requests, Executor, Document, DocumentArray, Client
class MyExec(Executor):
@requests(on='/foo')
def foo(self, docs, **kwargs):
for d in docs:
d.text = 'foo'
# change bind to bar()
f = Flow().add(uses=MyExec, uses_requests={'/index': 'foo', '/search': 'foo'})
with f:
req = Client(port=f.port).post(
'/index', Document()
)
print(req[0].text)
Import Executor from installed Python modules
You can now import Executors from a module path by passing it in the py_modules
.
f = Flow().add(uses='MyExecutor', py_modules=['module.path.to.my_executor'])
Expose Jina environment information on every Runtime βΉοΈ
Each Flow microservice provides an endpoint that exposes relevant information about the environment where it runs.
Other changes
- Support passing different monitoring ports for each replica when running Flow locally #4961
- Show the monitoring ports of replicas in logs #4956
- Efficient access to parameters from Request without serializing DocumentArray protobuf #4991
- Asynchronously send gather endpoints requests from Gateway without awaiting them #5015