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

Add conf parameter to CLI for airflow dags test #25900

Merged
5 changes: 4 additions & 1 deletion airflow/cli/commands/dag_command.py
Expand Up @@ -453,7 +453,10 @@ def dag_test(args, session=None):
"""Execute one single DagRun for a given DAG and execution date, using the DebugExecutor."""
run_conf = None
if args.conf:
run_conf = json.loads(args.conf)
try:
run_conf = json.loads(args.conf)
except ValueError as e:
raise SystemExit(f"Configuration '{args.conf}' is not valid JSON. Error: {e}")
uranusjr marked this conversation as resolved.
Show resolved Hide resolved

dag = get_dag(subdir=args.subdir, dag_id=args.dag_id)
dag.clear(start_date=args.execution_date, end_date=args.execution_date, dag_run_state=False)
Expand Down