You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jedcunningham (via GitHub)" <gi...@apache.org> on 2025/03/20 20:50:06 UTC
[PR] Use SimpleAuthManager for standalone [airflow]
jedcunningham opened a new pull request, #48036:
URL: https://github.com/apache/airflow/pull/48036
This fixes the standalone command.
At the same time, it switches standalone to use SimpleAuthManager (and forces the use of standalone!).
Similar to before, if it's the first time you run, the username and password will be printed out - now just at the very top of the output (which honestly is a bit easier to see before a ton of lines start
flying by). However, it will only output the password once. On
subsequent starts, it will print the file that contains the file so you can go grab the password yourself if you need it. This was done since there isn't a trivial way to both use the same password with standalone and api-server directly and make sure we aren't outputting a password you've populated yourself.
On a fresh start:
```
standalone | Starting Airflow Standalone
Simple auth manager | Password for user 'admin': r9GPxU6cn8Y7u29x
```
On a subsequent start:
```
standalone | Starting Airflow Standalone
standalone | Password for the admin user has been previously generated in /Users/jedc/airflow/simple_auth_manager_passwords.json.generated. Not echoing it here.
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use SimpleAuthManager for standalone [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #48036:
URL: https://github.com/apache/airflow/pull/48036#discussion_r2007738173
##########
airflow/cli/commands/local_commands/standalone_command.py:
##########
@@ -179,24 +180,48 @@ def calculate_env(self):
else:
self.print_output("standalone", "Forcing executor to LocalExecutor")
env["AIRFLOW__CORE__EXECUTOR"] = executor_constants.LOCAL_EXECUTOR
+
+ # Make sure we're using SimpleAuthManager
+ simple_auth_manager_classpath = (
+ "airflow.api_fastapi.auth.managers.simple.simple_auth_manager.SimpleAuthManager"
+ )
+ if conf.get("core", "auth_manager") != simple_auth_manager_classpath:
+ self.print_output("standalone", "Forcing auth manager to SimpleAuthManager")
+ env["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath
+ os.environ["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath # also in this process!
+
return env
+ def find_user_info(self):
+ if conf.get("core", "simple_auth_manager_users") != "admin:admin":
Review Comment:
Got it thanks
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use SimpleAuthManager for standalone [airflow]
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on PR #48036:
URL: https://github.com/apache/airflow/pull/48036#issuecomment-2743602903
> Should we remove the big scary warning for this use case do you think?
We can't today, unfortunately. But it probably should be toggle-able. If we do though, should be in a follow up.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use SimpleAuthManager for standalone [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #48036:
URL: https://github.com/apache/airflow/pull/48036#issuecomment-2745400463
Nice!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use SimpleAuthManager for standalone [airflow]
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham merged PR #48036:
URL: https://github.com/apache/airflow/pull/48036
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use SimpleAuthManager for standalone [airflow]
Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on code in PR #48036:
URL: https://github.com/apache/airflow/pull/48036#discussion_r2007693403
##########
airflow/cli/commands/local_commands/standalone_command.py:
##########
@@ -179,24 +180,48 @@ def calculate_env(self):
else:
self.print_output("standalone", "Forcing executor to LocalExecutor")
env["AIRFLOW__CORE__EXECUTOR"] = executor_constants.LOCAL_EXECUTOR
+
+ # Make sure we're using SimpleAuthManager
+ simple_auth_manager_classpath = (
+ "airflow.api_fastapi.auth.managers.simple.simple_auth_manager.SimpleAuthManager"
+ )
+ if conf.get("core", "auth_manager") != simple_auth_manager_classpath:
+ self.print_output("standalone", "Forcing auth manager to SimpleAuthManager")
+ env["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath
+ os.environ["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath # also in this process!
+
return env
+ def find_user_info(self):
+ if conf.get("core", "simple_auth_manager_users") != "admin:admin":
Review Comment:
The two users exist only in Breeze. Though I am not sure what this check does. If the user changed the default config of `[core] simple_auth_manager_users`, we should not init simple auth manager?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use SimpleAuthManager for standalone [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #48036:
URL: https://github.com/apache/airflow/pull/48036#issuecomment-2743373121
Should we remove the big scary warning for this use case do you think?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use SimpleAuthManager for standalone [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #48036:
URL: https://github.com/apache/airflow/pull/48036#discussion_r2007604123
##########
airflow/cli/commands/local_commands/standalone_command.py:
##########
@@ -179,24 +180,48 @@ def calculate_env(self):
else:
self.print_output("standalone", "Forcing executor to LocalExecutor")
env["AIRFLOW__CORE__EXECUTOR"] = executor_constants.LOCAL_EXECUTOR
+
+ # Make sure we're using SimpleAuthManager
+ simple_auth_manager_classpath = (
+ "airflow.api_fastapi.auth.managers.simple.simple_auth_manager.SimpleAuthManager"
+ )
+ if conf.get("core", "auth_manager") != simple_auth_manager_classpath:
+ self.print_output("standalone", "Forcing auth manager to SimpleAuthManager")
+ env["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath
+ os.environ["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath # also in this process!
+
return env
+ def find_user_info(self):
+ if conf.get("core", "simple_auth_manager_users") != "admin:admin":
Review Comment:
I'm not sure i understand this check, we now have two users, which I think we should keep in standalone too. (Admin and viewer) those are helpful
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use SimpleAuthManager for standalone [airflow]
Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #48036:
URL: https://github.com/apache/airflow/pull/48036#discussion_r2007730819
##########
airflow/cli/commands/local_commands/standalone_command.py:
##########
@@ -179,24 +180,48 @@ def calculate_env(self):
else:
self.print_output("standalone", "Forcing executor to LocalExecutor")
env["AIRFLOW__CORE__EXECUTOR"] = executor_constants.LOCAL_EXECUTOR
+
+ # Make sure we're using SimpleAuthManager
+ simple_auth_manager_classpath = (
+ "airflow.api_fastapi.auth.managers.simple.simple_auth_manager.SimpleAuthManager"
+ )
+ if conf.get("core", "auth_manager") != simple_auth_manager_classpath:
+ self.print_output("standalone", "Forcing auth manager to SimpleAuthManager")
+ env["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath
+ os.environ["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath # also in this process!
+
return env
+ def find_user_info(self):
+ if conf.get("core", "simple_auth_manager_users") != "admin:admin":
Review Comment:
We only need to init the auth manager if we need to generate the admin password.
If someone has updated the `simple_auth_manager_users` config, they've already moved away from a single user named "admin", so providing them more guidance here isn't really necessary.
Basically, trying to strike roughly the same behavior of, if you've configured stuff yourself already, we let you do your thing. If you are in the fresh/default environment, we give you some pointers.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use SimpleAuthManager for standalone [airflow]
Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on code in PR #48036:
URL: https://github.com/apache/airflow/pull/48036#discussion_r2007746889
##########
airflow/cli/commands/local_commands/standalone_command.py:
##########
@@ -179,24 +180,48 @@ def calculate_env(self):
else:
self.print_output("standalone", "Forcing executor to LocalExecutor")
env["AIRFLOW__CORE__EXECUTOR"] = executor_constants.LOCAL_EXECUTOR
+
+ # Make sure we're using SimpleAuthManager
+ simple_auth_manager_classpath = (
+ "airflow.api_fastapi.auth.managers.simple.simple_auth_manager.SimpleAuthManager"
+ )
+ if conf.get("core", "auth_manager") != simple_auth_manager_classpath:
+ self.print_output("standalone", "Forcing auth manager to SimpleAuthManager")
+ env["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath
+ os.environ["AIRFLOW__CORE__AUTH_MANAGER"] = simple_auth_manager_classpath # also in this process!
+
return env
+ def find_user_info(self):
+ if conf.get("core", "simple_auth_manager_users") != "admin:admin":
Review Comment:
Sounds good
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org