簡體   English   中英

在 Airflow 中為 postgres 創建默認用戶時出錯

[英]Error when creating default user for postgres in Airflow

運行命令以創建新的 postgres 用戶時出現以下錯誤。 任何可能導致此問題的想法 - 該錯誤似乎與我運行的create bash 命令無關。

(sandbox) airflow@airflowvm:~/airflow$ airflow users create -u admin -p admin -r Admin -f admin -l admin -e admin@airflow.com

Traceback (most recent call last):
  File "/home/airflow/sandbox/bin/airflow", line 8, in <module>
    sys.exit(main())
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/__main__.py", line 40, in main
    args.func(args)
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/cli/cli_parser.py", line 47, in command
    func = import_string(import_path)
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/utils/module_loading.py", line 32, in import_string
    module = import_module(module_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/cli/commands/user_command.py", line 29, in <module>
    from airflow.www.app import cached_app
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/www/app.py", line 38, in <module>
    from airflow.www.extensions.init_views import (
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/www/extensions/init_views.py", line 29, in <module>
    from airflow.www.views import lazy_add_provider_discovered_options_to_connection_form
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/www/views.py", line 2836, in <module>
    class ConnectionFormWidget(FormWidget):
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/www/views.py", line 2839, in ConnectionFormWidget
    field_behaviours = json.dumps(ProvidersManager().field_behaviours)
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/providers_manager.py", line 397, in field_behaviours
    self.initialize_providers_manager()
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/providers_manager.py", line 129, in initialize_providers_manager
    self._discover_all_providers_from_packages()
  File "/home/airflow/sandbox/lib/python3.8/site-packages/airflow/providers_manager.py", line 149, in _discover_all_providers_from_packages
    self._provider_schema_validator.validate(provider_info)
  File "/home/airflow/sandbox/lib/python3.8/site-packages/jsonschema/validators.py", line 353, in validate
    raise error
jsonschema.exceptions.ValidationError: Additional properties are not allowed ('logo' was unexpected)

Failed validating 'additionalProperties' in schema['properties']['integrations']['items']:
    {'additionalProperties': False,
     'properties': {'external-doc-url': {'description': 'URL to external '
                                                        'documentation for '
                                                        'the integration.',
                                         'type': 'string'},
                    'how-to-guide': {'description': 'List of paths to '
                                                    'how-to-guide for the '
                                                    'integration. The path '
                                                    'must start with '
                                                    "'/docs/'",
                                     'items': {'type': 'string'},
                                     'type': 'array'},
                    'integration-name': {'description': 'Name of the '
                                                        'integration.',
                                         'type': 'string'},
                    'tags': {'description': 'List of tags describing the '
                                            "integration. While we're "
                                            'using RST, only one tag is '
                                            'supported per integration.',
                             'items': {'enum': ['apache',
                                                'aws',
                                                'azure',
                                                'gcp',
                                                'gmp',
                                                'google',
                                                'protocol',
                                                'service',
                                                'software',
                                                'yandex'],
                                       'type': 'string'},
                             'maxItems': 1,
                             'minItems': 1,
                             'type': 'array'}},
     'required': ['integration-name', 'external-doc-url', 'tags'],
     'type': 'object'}

On instance['integrations'][0]:
    {'external-doc-url': 'https://www.postgresql.org/',
     'how-to-guide': ['/docs/apache-airflow-providers-postgres/operators/postgres_operator_howto_guide.rst'],
     'integration-name': 'PostgreSQL',
     'logo': '/integration-logos/postgres/Postgres.png',
     'tags': ['software']}

預期結果:

Admin user admin created

當我運行命令airflow db check ,我可以通過INFO - Connection successful.連接INFO - Connection successful.

我相信您將 Airflow 2.0.0 與不兼容的 Provider 一起使用(可能在您安裝時強制使用)。 如果您想使用具有 >= 2.1 限制的 Postgres Provider,請將 Airflow 升級到 2.1+。

請參閱此處更改日志中的評論: https : //airflow.apache.org/docs/apache-airflow-providers-postgres/stable/index.html#id1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM