You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by fo...@apache.org on 2018/05/14 08:35:45 UTC
incubator-airflow git commit: [AIRFLOW-2376] Fix no hive section error
Repository: incubator-airflow
Updated Branches:
refs/heads/master 648e1e693 -> 92363490b
[AIRFLOW-2376] Fix no hive section error
Closes #3343 from feng-tao/airflow-2376
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/92363490
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/92363490
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/92363490
Branch: refs/heads/master
Commit: 92363490b725cca345298a9f10613257a7500c9a
Parents: 648e1e6
Author: Tao feng <tf...@lyft.com>
Authored: Mon May 14 10:35:39 2018 +0200
Committer: Fokko Driesprong <fo...@godatadriven.com>
Committed: Mon May 14 10:35:39 2018 +0200
----------------------------------------------------------------------
airflow/bin/cli.py | 9 ++++++++-
airflow/utils/configuration.py | 15 +++------------
2 files changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/92363490/airflow/bin/cli.py
----------------------------------------------------------------------
diff --git a/airflow/bin/cli.py b/airflow/bin/cli.py
index 1615e76..931849c 100644
--- a/airflow/bin/cli.py
+++ b/airflow/bin/cli.py
@@ -19,6 +19,7 @@
# under the License.
from __future__ import print_function
+from backports.configparser import NoSectionError
import logging
import os
@@ -438,7 +439,13 @@ def run(args, dag=None):
# core.sql_alchemy_pool_recycle
for section, config in conf_dict.items():
for option, value in config.items():
- conf.set(section, option, value)
+ try:
+ conf.set(section, option, value)
+ except NoSectionError:
+ log.error('Section {section} Option {option} '
+ 'does not exist in the config!'.format(section=section,
+ option=option))
+
settings.configure_vars()
# IMPORTANT, have to use the NullPool, otherwise, each "run" command may leave
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/92363490/airflow/utils/configuration.py
----------------------------------------------------------------------
diff --git a/airflow/utils/configuration.py b/airflow/utils/configuration.py
index 0984428..18a338c 100644
--- a/airflow/utils/configuration.py
+++ b/airflow/utils/configuration.py
@@ -7,9 +7,9 @@
# 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
@@ -26,11 +26,6 @@ from tempfile import mkstemp
from airflow import configuration as conf
-COPY_SECTIONS = [
- 'core', 'smtp', 'scheduler', 'celery', 'webserver', 'hive'
-]
-
-
def tmp_configuration_copy():
"""
Returns a path for a temporary file including a full copy of the configuration
@@ -40,11 +35,7 @@ def tmp_configuration_copy():
cfg_dict = conf.as_dict(display_sensitive=True)
temp_fd, cfg_path = mkstemp()
- cfg_subset = dict()
- for section in COPY_SECTIONS:
- cfg_subset[section] = cfg_dict.get(section, {})
-
with os.fdopen(temp_fd, 'w') as temp_file:
- json.dump(cfg_subset, temp_file)
+ json.dump(cfg_dict, temp_file)
return cfg_path