class jina.drivers.encode.BaseEncodeDriver(executor=None, method='encode', *args, **kwargs)[source]

Bases: jina.drivers.BaseExecutableDriver

Drivers inherited from this Driver will bind encode() by default

Initialize a BaseExecutableDriver

  • executor (Optional[str]) – the name of the sub-executor, only necessary when jina.executors.compound.CompoundExecutor is used

  • method (str) – the function name of the executor that the driver feeds to

class jina.drivers.encode.EncodeDriver(batch_size=None, *args, **kwargs)[source]

Bases: jina.drivers.encode.BaseEncodeDriver

Extract the content from documents and call executor and do encoding

Extract from different documents. :type batch_size: Optional[int] :param batch_size: number of documents to be used simultaniously in the encoder :meth:apply_all. It is specially useful when the same EncoderExecutor can be used for documents of different granularities

(chunks, chunks of chunks …)


  • This parameter was added to cover the case where root documents had very few chunks, and the encoder executor could

then only process them in batches of the chunk size of each document, which did not lead to the full use of batching capabilities of the powerful Executors

class CacheDocumentSet(capacity=None, *args, **kwargs)[source]

Bases: object

Helper class to accumulate documents from differents document Set in a single DocumentSet to help guarantee that the encoder driver can consume documents in fixed batch sizes to allow the EncoderExecutors to leverage its batching abilities.

It is useful to have batching even when chunks are involved

property available_capacity