Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error when DAG does not exist when running dag pause command #13900

Merged
merged 1 commit into from
Jan 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions airflow/cli/commands/dag_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,12 @@ def dag_unpause(args):

def set_is_paused(is_paused, args):
"""Sets is_paused for DAG by a given dag_id"""
DagModel.get_dagmodel(args.dag_id).set_is_paused(
is_paused=is_paused,
)
dag = DagModel.get_dagmodel(args.dag_id)

if not dag:
raise SystemExit(f"DAG: {args.dag_id} does not exit in 'dag' table")

dag.set_is_paused(is_paused=is_paused)

print(f"Dag: {args.dag_id}, paused: {is_paused}")

Expand Down