gpt4 book ai didi

python - 全新安装 Apache Airflow 2.2.3 .. OOps 发生了一些不好的事情

转载 作者:行者123 更新时间:2023-12-04 19:05:41 25 4
gpt4 key购买 nike

我已经通过 pip .. 成功地在本地安装了 apache Airflow ,并带有一些需要的引脚

pip3 install zipp==3.1.0
pip3 install sqlalchemy==1.3.24
python3 -m pip install virtualenv
pip3 install apache-airflow[cncf.kubernetes]

pip3 install apache-airflow
因为我是 n00b在所有这些东西中,我都是从基础开始的。我首先尝试了 airflow standalone但是在文档中没有说明默认用户名和密码是什么......所以我进去并只是用一个基本用户启动了一些服务......
airflow db init
airflow users create --role Admin --username admin --email admin --firstname admin --lastname admin --password admin
现在这只需要启动..我意识到我需要启动调度程序和webapp ......由于某种原因我的自动脚本没有这样做..我必须手动执行但是..
airflow scheduler &
airflow webapp
现在一切都好..我可以看到我有一个启动 GUI 并正在运行.. 一切似乎都很好.. 我想启动我发现的第一个 DAG example_bash_operator问题是...当我单击名称时...
Python version: 3.8.10
Airflow version: 2.2.3
Node: juju-2dd159-310.lxd
-------------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/www/auth.py", line 51, in decorated
return func(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/www/decorators.py", line 72, in wrapper
return f(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/utils/session.py", line 70, in wrapper
return func(*args, session=session, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/www/views.py", line 1732, in trigger
if unpause and dag.is_paused:
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/models/dag.py", line 1081, in is_paused
warnings.warn(
File "/usr/lib/python3.8/warnings.py", line 109, in _showwarnmsg
sw(msg.message, msg.category, msg.filename, msg.lineno,
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/settings.py", line 117, in custom_show_warning
write_console.print(msg, soft_wrap=True)
File "/home/ubuntu/.local/lib/python3.8/site-packages/rich/console.py", line 1642, in print
self._buffer.extend(new_segments)
File "/home/ubuntu/.local/lib/python3.8/site-packages/rich/console.py", line 842, in __exit__
self._exit_buffer()
File "/home/ubuntu/.local/lib/python3.8/site-packages/rich/console.py", line 800, in _exit_buffer
self._check_buffer()
File "/home/ubuntu/.local/lib/python3.8/site-packages/rich/console.py", line 1935, in _check_buffer
self.file.flush()
BrokenPipeError: [Errno 32] Broken pipe
如果我忽略了这一点,也许等一下,或者只是再试一次..突然它起作用了......有什么线索可以让这种体验变得顺畅吗?
编辑:如果这有助于回答问题
ubuntu@juju-2dd159-311:~$ pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
ubuntu@juju-2dd159-311:~$ python3 --version
Python 3.8.10

编辑#2
我按照这些说明安装了他们想要的约束 https://airflow.apache.org/docs/apache-airflow/stable/start/local.html
这极大地修复了 GUI 和 UI 中的稳定性.. .但是......然后我开始连接 postgresql 数据库......现在它甚至不会在没有 brokenpipe 的情况下登录错误
Python version: 3.8.10
Airflow version: 2.2.3
Node: juju-2dd159-318.lxd
-------------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/www/auth.py", line 51, in decorated
return func(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/www/views.py", line 718, in index
paging=wwwutils.generate_pages(
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/www/utils.py", line 113, in generate_pages
previous_node = Markup(
File "/home/ubuntu/.local/lib/python3.8/site-packages/jinja2/utils.py", line 838, in __new__
warnings.warn(
File "/usr/lib/python3.8/warnings.py", line 109, in _showwarnmsg
sw(msg.message, msg.category, msg.filename, msg.lineno,
File "/home/ubuntu/.local/lib/python3.8/site-packages/airflow/settings.py", line 117, in custom_show_warning
write_console.print(msg, soft_wrap=True)
File "/home/ubuntu/.local/lib/python3.8/site-packages/rich/console.py", line 1642, in print
self._buffer.extend(new_segments)
File "/home/ubuntu/.local/lib/python3.8/site-packages/rich/console.py", line 842, in __exit__
self._exit_buffer()
File "/home/ubuntu/.local/lib/python3.8/site-packages/rich/console.py", line 800, in _exit_buffer
self._check_buffer()
File "/home/ubuntu/.local/lib/python3.8/site-packages/rich/console.py", line 1935, in _check_buffer
self.file.flush()

最佳答案

您是否尝试按照“快速启动”说明进行操作?
https://airflow.apache.org/docs/apache-airflow/stable/start/index.html
Airflow 有关于如何开始的很好和全面的说明,如果你一步一步地遵循它,你将让 Airlfow 启动并运行。这可以通过 docker compose 或本地 virtualenv 来完成。
您的问题可能是缺乏资源 - 内存(很可能)。 Airflow 需要相当多的内存(4GB)才能启动,因为它是一个复杂的系统。它是作为先决条件编写的,尤其是在 Docker Compose 快速入门中。如果你没有足够的资源,Docker Compose 甚至会警告你,所以如果你想要真正可靠和强大的快速入门,我推荐这个。
您需要查看您的日志以了解您为什么会出现管道错误。但最有可能的原因是缺乏资源。
关于“独立”模式和用户密码 - 您可能错过了 Airflow 写给您的内容。它在启动时动态生成密码,并实际告诉您应该使用什么密码:

standalone | 
standalone | Airflow is ready
standalone | Login with username: admin password: 4hfH8mATcvMFmne9
standalone | Airflow Standalone is for development purposes only. Do not use this in production!
standalone |

关于python - 全新安装 Apache Airflow 2.2.3 .. OOps 发生了一些不好的事情,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70544127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com