Skip to content

Commit

Permalink
Suppress LOG/WARNING for a few tasks CLI for better CLI experience (#…
Browse files Browse the repository at this point in the history
…14567)

For 'state'/'list'/'render', more likely users
would like to rely on the CLI output for some works,
and the Python LOG/WARNING prints cause inconvenience.
  • Loading branch information
XD-DENG authored Mar 3, 2021
1 parent bcc8b5e commit 9c44f81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions airflow/cli/cli_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ class GroupCommand(NamedTuple):
name='list',
help="List the tasks within a DAG",
func=lazy_load_command('airflow.cli.commands.task_command.task_list'),
args=(ARG_DAG_ID, ARG_TREE, ARG_SUBDIR),
args=(ARG_DAG_ID, ARG_TREE, ARG_SUBDIR, ARG_VERBOSE),
),
ActionCommand(
name='clear',
Expand All @@ -956,7 +956,7 @@ class GroupCommand(NamedTuple):
name='state',
help="Get the status of a task instance",
func=lazy_load_command('airflow.cli.commands.task_command.task_state'),
args=(ARG_DAG_ID, ARG_TASK_ID, ARG_EXECUTION_DATE, ARG_SUBDIR),
args=(ARG_DAG_ID, ARG_TASK_ID, ARG_EXECUTION_DATE, ARG_SUBDIR, ARG_VERBOSE),
),
ActionCommand(
name='failed-deps',
Expand All @@ -973,7 +973,7 @@ class GroupCommand(NamedTuple):
name='render',
help="Render a task instance's template(s)",
func=lazy_load_command('airflow.cli.commands.task_command.task_render'),
args=(ARG_DAG_ID, ARG_TASK_ID, ARG_EXECUTION_DATE, ARG_SUBDIR),
args=(ARG_DAG_ID, ARG_TASK_ID, ARG_EXECUTION_DATE, ARG_SUBDIR, ARG_VERBOSE),
),
ActionCommand(
name='run',
Expand Down
3 changes: 3 additions & 0 deletions airflow/cli/commands/task_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def task_failed_deps(args):


@cli_utils.action_logging
@suppress_logs_and_warning
def task_state(args):
"""
Returns the state of a TaskInstance at the command line.
Expand All @@ -276,6 +277,7 @@ def task_state(args):


@cli_utils.action_logging
@suppress_logs_and_warning
def task_list(args, dag=None):
"""Lists the tasks within a DAG at the command line"""
dag = dag or get_dag(args.subdir, args.dag_id)
Expand Down Expand Up @@ -397,6 +399,7 @@ def task_test(args, dag=None):


@cli_utils.action_logging
@suppress_logs_and_warning
def task_render(args):
"""Renders and displays templated fields for a given task"""
dag = get_dag(args.subdir, args.dag_id)
Expand Down

0 comments on commit 9c44f81

Please sign in to comment.