mik-laj commented on a change in pull request #5975: [AIRFLOW-5368] Display DAG
from the CLI
URL: https://github.com/apache/airflow/pull/5975#discussion_r320224848
##########
File path: airflow/bin/cli.py
##########
@@ -441,6 +442,33 @@ def set_is_paused(is_paused, args):
print("Dag: {}, paused: {}".format(args.dag_id, str(is_paused)))
+def show_dag(args):
+ dag = get_dag(args)
+ dot = render_dag(dag)
+ if args.save:
+ filename, _, fileformat = args.save.rpartition('.')
+ dot.render(filename=filename, format=fileformat, cleanup=True)
+ print("File {} saved".format(args.save))
+ elif args.imgcat:
+ data = dot.pipe(format='png')
+ try:
+ proc = subprocess.Popen("imgcat", stdout=subprocess.PIPE,
stdin=subprocess.PIPE)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ raise AirflowException(
+ "Failed to execute. Make sure the imgcat executables are
on your systems \'PATH\'"
+ )
+ else:
+ raise
+ out, err = proc.communicate(data)
+ if out:
+ print(out.decode('utf-8'))
+ if err:
+ print(err.decode('utf-8'))
+ else:
+ print(dot.source)
Review comment:
After that, I thought about the problem that there are these logs. I think
airflow should be completely independent of CLI. Docker and kubernetes work
similarly. This is important when we want Airflow to be completely serverless
and secure. If I understand correctly, currently CLI always gives full access
to Airflow. This is on my list of ideas.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services