zzzzaaa-000 commented on issue #49139:
URL: https://github.com/apache/airflow/issues/49139#issuecomment-2809121511
你遇到的是关于 Airflow CLI 工具 (airflowctl)
的开发/提交规范问题,主要是在命令执行前需要检查是否已经加载了凭证(credentials),如果没有需要提示用户登录。同时,你要声明你是 Apache
Airflow 项目的 committer 或 maintainer。
下面分别解释怎么解决:
1. 在每个 airflowctl 命令中检查凭证
思路:
每次执行命令时,首先检查凭证是否已经加载。如果没有,提示用户登录。
Python 伪代码实现举例
假设你在开发 airflowctl,可以加一个装饰器或统一的前置检查:
python
def require_credentials(func):
def wrapper(*args, **kwargs):
if not credentials_loaded():
print("You are not logged in. Please run 'airflowctl login'
first.")
exit(1)
return func(*args, **kwargs)
return wrapper
@require_credentials
def run_some_command():
# 你的命令逻辑
pass
def credentials_loaded():
# 判断本地凭证文件、env变量或调用API等方式
# return True or False
...
在每个命令入口加上 @require_credentials,或者在 CLI 命令解析主入口统一做检查。
2. 解决 committer 声明问题
你写的
I acknowledge that I am a maintainer/committer of the Apache Airflow project.
这通常是提交代码到 Apache 项目时的流程要求:
你如果是 committer,需要在 PR 或 commit message 里加上这类声明,表示你有权限进行相应操作。
如果你不是 committer,你不需要加这句话。 具体回复在我的AI
https://code.mayoubang.cn/conversion/share/87060137106
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]