You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/01 08:58:29 UTC

[GitHub] [airflow] tirkarthi commented on a change in pull request #22588: Print configuration on scheduler startup.

tirkarthi commented on a change in pull request #22588:
URL: https://github.com/apache/airflow/pull/22588#discussion_r840379038



##########
File path: tests/cli/commands/test_scheduler_command.py
##########
@@ -87,3 +91,18 @@ def test_graceful_shutdown(self, executor, mock_process, mock_scheduler_job):
                 scheduler_command.scheduler(args)
             finally:
                 mock_process().terminate.assert_called()
+
+    @mock.patch.dict(os.environ, {'AIRFLOW__CORE__PARALLELISM': '35'}, clear=True)
+    @mock.patch("airflow.cli.commands.scheduler_command.SchedulerJob")
+    @mock.patch("airflow.cli.commands.scheduler_command.Process")
+    def test_scheduler_print_config(self, mock_process, mock_scheduler_job):
+        args = self.parser.parse_args(['scheduler'])
+        with conf_vars({("core", "sql_alchemy_conn_cmd"): 'echo hello'}):
+            with contextlib.redirect_stdout(io.StringIO()) as temp_stdout:
+                scheduler_command.scheduler(args)
+                output = temp_stdout.getvalue()
+
+                assert "sql_alchemy_conn = < hidden > [cmd]" in output
+                assert "max_active_tasks_per_dag = 16 [airflow.cfg]" in output
+                assert "parallelism = < hidden > [env var]" in output

Review comment:
       I have `display_sensitive=False` (default value is False) which hides all values from env, vars and command. I don't want to pass display_sensitive=True since that might dump sensitive values to logs in case of starting as daemon or systemd. I guess we can try filtering for sensitive values in the for loop similar to how "default" values are filtered out so that other values from env/cmd are shown. Thoughts?
   
   https://github.com/apache/airflow/blob/dc75f5d8768c8a42df29c86beb519de282539e1f/airflow/configuration.py#L717-L719




-- 
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