Skip to content

Commit

Permalink
[AIRFLOW-3099] Complete list of optional airflow.cfg sections (#4002)
Browse files Browse the repository at this point in the history
  • Loading branch information
chang authored and kaxil committed Oct 7, 2018
1 parent 9bea622 commit e4648b3
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions airflow/bin/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,24 @@ def _run(args, dag, ti):

@cli_utils.action_logging
def run(args, dag=None):
# Optional sections won't log an error if they're missing in airflow.cfg.
OPTIONAL_AIRFLOW_CFG_SECTIONS = [
'atlas',
'celery',
'celery_broker_transport_options',
'dask',
'elasticsearch',
'github_enterprise',
'hive',
'kerberos',
'kubernetes',
'kubernetes_node_selectors',
'kubernetes_secrets',
'ldap',
'lineage',
'mesos',
]

if dag:
args.dag_id = dag.dag_id

Expand All @@ -510,18 +528,15 @@ def run(args, dag=None):
try:
conf.set(section, option, value)
except NoSectionError:
optional_sections = [
'atlas', 'mesos', 'elasticsearch', 'kubernetes',
'lineage', 'hive'
]
if section in optional_sections:
log.debug('Section {section} Option {option} '
'does not exist in the config!'.format(section=section,
option=option))
no_section_msg = (
'Section {section} Option {option} '
'does not exist in the config!'
).format(section=section, option=option)

if section in OPTIONAL_AIRFLOW_CFG_SECTIONS:
log.debug(no_section_msg)
else:
log.error('Section {section} Option {option} '
'does not exist in the config!'.format(section=section,
option=option))
log.error(no_section_msg)

settings.configure_vars()

Expand Down

0 comments on commit e4648b3

Please sign in to comment.