Executor
YAML Syntax¶
All executors defined in jina.executors
can be loaded from a YAML config via jina.executors.BaseExecutor.load_config()
or via the CLI jina pod --uses.
The executor YAML config follows the syntax below.
!BasePbIndexer
with:
index_filename: doc.gzip
metas: # <- metas defined in :mod`jina.executors.metas`
name: doc_indexer # a customized name
workspace: $TEST_WORKDIR
-
!SomeExecutorClass
¶ The class of the executor, can be any class inherited from
jina.executors.BaseExecutor
. Note that it must starts with!
to tell the YAML parser that the section below is describing this class.
-
with
¶ A list of arguments in the
__init__()
function of this executor. One can use environment variables here to expand the variables.
-
metas
¶ A list of meta arguments defined in
jina.executors.metas
.
If an executor has no __init__()
or __init__()
requires no arguments, then one do not need to write with
at all.
In the minimum case, if you don’t want to specify any with
and metas
, you can simply write:
# encoder.yml
!AwesomeExecutor
Or even not using this YAML but simply write:
import jina.executors.BaseExecutor
a = BaseExecutor.load_config('AwesomeExecutor')