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)[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

      Return type

      Union[ForwardRef, ForwardRef]

  • dump(data)[source]

    Return the dictionary given a versioned flow object

    • Parameters

      data (Union[ForwardRef, ForwardRef]) – versioned flow object

      Return type

      Dict