You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/09/02 12:20:24 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #5975: [AIRFLOW-5368] Display DAG from the CLI

kaxil commented on a change in pull request #5975: [AIRFLOW-5368] Display DAG from the CLI
URL: https://github.com/apache/airflow/pull/5975#discussion_r319934597
 
 

 ##########
 File path: airflow/bin/cli.py
 ##########
 @@ -441,6 +443,41 @@ 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 = graphviz.Digraph(args.dag_id, graph_attr={
+        'rankdir': 'LR',
+        'labelloc': "t",
+        'label': args.dag_id
+    })
+    for task in dag.tasks:
+        dot.node(task.task_id)
+        for downstream_task_id in task.downstream_task_ids:
+            dot.edge(task.task_id, downstream_task_id)
+    if args.save:
+        filename, _, format = args.save.rpartition('.')
 
 Review comment:
   ```suggestion
           filename, _, fileformat = args.save.rpartition('.')
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services