コード例 #1
0
from jina.schemas.helper import _cli_to_schema
from jina_cli.export import api_to_dict

for s in ('flow', 'gateway', 'executor'):
    a = _cli_to_schema(api_to_dict(), s)

    table = [
        '| Name | Description | Type | Default |', '|----|----|----|----|'
    ]

    for k, v in a[f'Jina::{s.capitalize()}']['properties'].items():
        desc = v["description"].replace("\n", "<br>")
        if k in ('port', 'port_monitoring'):
            v['default'] = 'random in [49152, 65535]'  # avoid random numbers cause devbot forever committing
        table.append(f'| `{k}` | {desc} | `{v["type"]}` | `{v["default"]}` |')

    with open(f'../docs/fundamentals/flow/{s}-args.md', 'w') as fp:
        fp.write('\n'.join(table))
コード例 #2
0
ファイル: deployment.py プロジェクト: srbhr/jina
schema_deployment = _cli_to_schema(
    api_to_dict(),
    'deployment',
    extras={
        'needs': {
            'description':
            'The name of the Deployment(s) that this Deployment receives data from. '
            'One can also use `gateway` to '
            'indicate the connection with the gateway.\n'
            'This is useful to create parallelization. '
            'By default the Flow always works sequentially '
            'following the defined order of the Deployments.',
            'type': ['array', 'string'],
            'items': {
                'type': 'string',
                'minItems': 1,
                "uniqueItems": True
            },
        },
        'method': {
            'description':
            'The method to use when appending the Deployment to the Flow',
            'type': 'string',
            'enum': ['add', 'needs', 'inspect', 'needs_all', 'gather_inspect'],
            'default': 'add',
        },
    },
    allow_addition=False,
    description='Define the config of a Deployment.',
)
コード例 #3
0
ファイル: flow.py プロジェクト: yuanl/jina
from cli.export import api_to_dict
from jina.schemas.helper import _cli_to_schema

_schema_flow_with = _cli_to_schema(
    api_to_dict(),
    'flow',
    allow_addition=False,
    description='The config of Flow, unrecognized config arguments will be applied to all Pods')['Jina::Flow']

schema_flow = {
    'Jina::Flow': {
        'properties': {
            'with': _schema_flow_with,
            'jtype': {
                'description': 'The type of Jina object (Flow, Executor, Driver).\n'
                               'A Flow is made up of several sub-tasks, and it manages the states and context of these sub-tasks.\n'
                               'The input and output data of Flows are Documents.',
                'type': 'string',
                'default': 'Flow',
                'enum': ['Flow', 'AsyncFlow']
            },
            'version': {
                'description': 'The YAML version of this Flow.',
                'type': 'string',
                'default': '\'1\'',
            },
            'pods': {
                'description': 'Define the steps in the Flow.\n'
                               'A Pod is a container and interface for one or multiple Peas that have the same properties.',
                'type': 'array',
                'items': {
コード例 #4
0
ファイル: flow.py プロジェクト: jina-ai/jina
from jina.schemas.helper import _cli_to_schema
from jina_cli.export import api_to_dict

_schema_flow_with = _cli_to_schema(
    api_to_dict(),
    ['flow', 'gateway'],
    allow_addition=False,
    description=
    'The config of Flow, unrecognized config arguments will be applied to all Deployments',
)['Jina::Flow']

schema_flow = {
    'Jina::Flow': {
        'properties': {
            'with': _schema_flow_with,
            'jtype': {
                'description':
                'The type of Jina object (Flow, Executor).\n'
                'A Flow is made up of several sub-tasks, and it manages the states and context of these sub-tasks.\n'
                'The input and output data of Flows are Documents.',
                'type':
                'string',
                'default':
                'Flow',
                'enum': ['Flow'],
            },
            'version': {
                'description': 'The YAML version of this Flow.',
                'type': 'string',
                'default': '\'1\'',
            },