jina.jaml.parsers.base module#

class jina.jaml.parsers.base.VersionedYAMLParser[source]#

Bases: object

Flow YAML parser for specific version

Every VersionedYAMLParser must implement two methods and one class attribute:
  • parse(): to load data (in dict) into a BaseFlow or BaseExecutor object

  • dump(): to dump a BaseFlow or BaseExecutor object into a dict

  • version: version number in str in format MAJOR.[MINOR]

version = 'legacy'#

the version number this parser designed for

parse(cls, data, runtime_args)[source]#

Return the Flow YAML parser given the syntax version number

Parameters
  • cls (type) – target class type to parse into, must be a JAMLCompatible type

  • data (Dict) – flow yaml file loaded as python dict

  • runtime_args (Optional[Dict[str, Any]]) – Optional runtime_args to be directly passed without being parsed into a yaml config

Return type

Union[Flow, BaseExecutor]

dump(data)[source]#

Return the dictionary given a versioned flow object

Parameters

data (Union[Flow, BaseExecutor]) – versioned flow object

Return type

Dict