airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From san...@apache.org
Subject incubator-airflow git commit: [AIRFLOW-369] Allow setting default DAG orientation
Date Thu, 11 Aug 2016 23:33:52 GMT
Repository: incubator-airflow
Updated Branches:
  refs/heads/master a737506bb -> ecdd8c6ea


[AIRFLOW-369] Allow setting default DAG orientation

Dear Airflow Maintainers,

Please accept this PR that addresses the following issues:

[AIRFLOW-369](https://issues.apache.org/jira/browse/AIRFLOW-369)

No tests infrastructure for webserver exists - verified manually.

Thanks.

Closes #1713 from spektom/dag_orientation


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/ecdd8c6e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/ecdd8c6e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/ecdd8c6e

Branch: refs/heads/master
Commit: ecdd8c6ea963c07b8561838b89bac45e354686ef
Parents: a737506
Author: Michael Spector <spektom@gmail.com>
Authored: Thu Aug 11 16:33:40 2016 -0700
Committer: Siddharth Anand <siddharthanand@yahoo.com>
Committed: Thu Aug 11 16:33:40 2016 -0700

----------------------------------------------------------------------
 airflow/configuration.py | 6 ++++++
 airflow/models.py        | 4 ++++
 airflow/www/views.py     | 3 ++-
 3 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/ecdd8c6e/airflow/configuration.py
----------------------------------------------------------------------
diff --git a/airflow/configuration.py b/airflow/configuration.py
index 31b8f36..e1b3481 100644
--- a/airflow/configuration.py
+++ b/airflow/configuration.py
@@ -133,6 +133,7 @@ defaults = {
         'worker_class': 'sync',
         'access_logfile': '',
         'error_logfile': '',
+        'dag_orientation': 'LR',
     },
     'scheduler': {
         'statsd_on': False,
@@ -326,6 +327,10 @@ filter_by_owner = False
 # in order to user the ldapgroup mode.
 owner_mode = user
 
+# Default DAG orientation. Valid values are: LR (Left->Right), TB (Top->Bottom),
+# RL (Right->Left), BT (Bottom->Top).
+dag_orientation = LR
+
 [email]
 email_backend = airflow.utils.email.send_email_smtp
 
@@ -466,6 +471,7 @@ default_owner = airflow
 base_url = http://localhost:8080
 web_server_host = 0.0.0.0
 web_server_port = 8080
+dag_orientation = LR
 
 [email]
 email_backend = airflow.utils.email.send_email_smtp

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/ecdd8c6e/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index df51be5..f4d7afd 100644
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -2606,6 +2606,8 @@ class DAG(BaseDag, LoggingMixin):
     :param sla_miss_callback: specify a function to call when reporting SLA
         timeouts.
     :type sla_miss_callback: types.FunctionType
+    :param orientation: Specify DAG orientation in graph view (LR, TB, RL, BT)
+    :type orientation: string
     """
 
     def __init__(
@@ -2621,6 +2623,7 @@ class DAG(BaseDag, LoggingMixin):
                 'core', 'max_active_runs_per_dag'),
             dagrun_timeout=None,
             sla_miss_callback=None,
+            orientation=configuration.get('webserver', 'dag_orientation'),
             params=None):
 
         self.user_defined_macros = user_defined_macros
@@ -2659,6 +2662,7 @@ class DAG(BaseDag, LoggingMixin):
         self.max_active_runs = max_active_runs
         self.dagrun_timeout = dagrun_timeout
         self.sla_miss_callback = sla_miss_callback
+        self.orientation = orientation
 
         self._comps = {
             'dag_id',

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/ecdd8c6e/airflow/www/views.py
----------------------------------------------------------------------
diff --git a/airflow/www/views.py b/airflow/www/views.py
index fa60b5c..08edd08 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -1228,7 +1228,6 @@ class Airflow(BaseView):
         session = settings.Session()
         dag_id = request.args.get('dag_id')
         blur = conf.getboolean('webserver', 'demo_mode')
-        arrange = request.args.get('arrange', "LR")
         dag = dagbag.get_dag(dag_id)
         if dag_id not in dagbag.dags:
             flash('DAG "{0}" seems to be missing.'.format(dag_id), "error")
@@ -1241,6 +1240,8 @@ class Airflow(BaseView):
                 include_upstream=True,
                 include_downstream=False)
 
+        arrange = request.args.get('arrange', dag.orientation)
+
         nodes = []
         edges = []
         for task in dag.tasks:


Mime
View raw message