jina.jaml.parsers.flow.v1 module
class jina.jaml.parsers.flow.v1.V1Parser[source]
Bases: jina.jaml.parsers.base.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(…)
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)[source]
Parameters
cls (
type
) – the class registered for dumping/loadingdata (
Dict
) – flow yaml file loaded as python dict
Return type
Returns
the Flow YAML parser given the syntax version number
dump(data)[source]
Parameters
data (Flow) – versioned flow object
Return type
Dict
Returns
the dictionary given a versioned flow object