airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] mik-laj commented on a change in pull request #7015: [AIRFLOW-6436] Create & Automate docs on Airflow Configs
Date Sat, 04 Jan 2020 01:29:40 GMT
mik-laj commented on a change in pull request #7015: [AIRFLOW-6436] Create & Automate docs
on Airflow Configs
URL: https://github.com/apache/airflow/pull/7015#discussion_r363007496
 
 

 ##########
 File path: airflow/utils/config_yaml_to_cfg.py
 ##########
 @@ -0,0 +1,116 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+Module to covert Airflow configs in config.yml to default_airflow.cfg file
+"""
+
+import os
+
+import yaml
+
+AIRFLOW_CONFIG_DIR = os.path.join(os.path.dirname(__file__), "..", "config_templates")
+AIRFLOW_DEFAULT_CONFIG = os.path.join(AIRFLOW_CONFIG_DIR, "default_airflow.cfg")
+AIRFLOW_CONFIG_YAML_FILE_PATH = os.path.join(AIRFLOW_CONFIG_DIR, "config.yml")
+FILE_HEADER = """# -*- coding: utf-8 -*-
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+# This is the template for Airflow's default configuration. When Airflow is
+# imported, it looks for a configuration file at $AIRFLOW_HOME/airflow.cfg. If
+# it doesn't exist, Airflow uses this template to generate it by replacing
+# variables in curly braces with their global values from configuration.py.
+
+# Users should not modify this file; they should customize the generated
+# airflow.cfg instead.
+
+
+# ----------------------- TEMPLATE BEGINS HERE -----------------------
+"""
+
+
+def default_config_yaml() -> dict:
 
 Review comment:
   Should we really do this when loading this module?  Maybe you can create a function that
will only be called in specific cases? If it is an executable file then it should have the
following code at the end of the file
   ```python
   if __name__ == '__main__':
       do_some_magic();
   ```
   
   Should it also be in the `airflow` directory? In my opinion, it looks better in the `tests`
or` scripts` directory.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message