airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] kaxil commented on a change in pull request #5975: [AIRFLOW-5368] Display DAG from the CLI
Date Mon, 02 Sep 2019 12:20:35 GMT
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_r319934662
 
 

 ##########
 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('.')
+        dot.render(filename=filename, format=format, cleanup=True)
 
 Review comment:
   ```suggestion
           dot.render(filename=filename, format=fileformat, cleanup=True)
   ```

----------------------------------------------------------------
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

Mime
View raw message