jina.jaml.parsers.flow.v1 module#
- class jina.jaml.parsers.flow.v1.V1Parser[source]#
Bases:
VersionedYAMLParser
V1Parser introduces new syntax and features:
It has a top-level field
version
deployments
is now a List of Dict (rather than a Dict as prev.)name
is now optional- new field
method
can be used to specify how to add this Deployment into the Flow, availables are: add
: (default) equal to Flow.add(…)needs
: (default) equal to Flow.needs(…)inspect
: (default) equal to Flow.inspect(…)
- new field
- An example V1 YAML config can be found below:
!Flow version: '1.0' deployments: - name: executor0 # notice the change here, name is now an attribute method: add # by default method is always add, available: add, needs, inspect needs: gateway - name: executor1 # notice the change here, name is now an attribute method: add # by default method is always add, available: add, needs, inspect needs: gateway - method: inspect # add an inspect node on executor1 - method: needs # let's try something new in Flow YAML v1: needs needs: [executor1, executor0]
- version = '1'#
the version number this parser designed for
- parse(cls, data, runtime_args=None)[source]#
- Parameters:
cls (
type
) – the class registered for dumping/loadingdata (
Dict
) – flow yaml file loaded as python dictruntime_args (
Optional
[Dict
[str
,Any
]]) – Optional runtime_args to be directly passed without being parsed into a yaml config
- Return type:
- Returns:
the Flow YAML parser given the syntax version number