You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by cr...@apache.org on 2016/05/20 15:06:06 UTC
[2/3] incubator-airflow git commit: AIRFLOW-119: List support for
tags in QuboleOperator
AIRFLOW-119: List support for tags in QuboleOperator
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/41a88c7d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/41a88c7d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/41a88c7d
Branch: refs/heads/master
Commit: 41a88c7d425802bb34430c7fea35c6ca32e1468c
Parents: d08c133
Author: Sumit Maheshwari <su...@qubole.com>
Authored: Wed May 18 14:23:42 2016 +0530
Committer: Sumit Maheshwari <su...@qubole.com>
Committed: Wed May 18 14:23:42 2016 +0530
----------------------------------------------------------------------
airflow/contrib/example_dags/example_qubole_operator.py | 2 +-
airflow/contrib/hooks/qubole_hook.py | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/41a88c7d/airflow/contrib/example_dags/example_qubole_operator.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/example_dags/example_qubole_operator.py b/airflow/contrib/example_dags/example_qubole_operator.py
index 464073a..a32e49b 100644
--- a/airflow/contrib/example_dags/example_qubole_operator.py
+++ b/airflow/contrib/example_dags/example_qubole_operator.py
@@ -39,7 +39,7 @@ t2 = QuboleOperator(
command_type="hivecmd",
script_location="s3n://dev.canopydata.com/airflow/show_table.hql",
notfiy=True,
- tags='aiflow_example_run',
+ tags=['tag1', 'tag2'],
trigger_rule="all_done",
dag=dag)
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/41a88c7d/airflow/contrib/hooks/qubole_hook.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/hooks/qubole_hook.py b/airflow/contrib/hooks/qubole_hook.py
index 7de6a14..120dcae 100755
--- a/airflow/contrib/hooks/qubole_hook.py
+++ b/airflow/contrib/hooks/qubole_hook.py
@@ -17,6 +17,7 @@ import os
import time
import datetime
import logging
+import six
from airflow.exceptions import AirflowException
from airflow.hooks.base_hook import BaseHook
@@ -155,14 +156,18 @@ class QuboleHook(BaseHook):
elif k in POSITIONAL_ARGS:
inplace_args = v
elif k == 'tags':
- tags.add(v)
+ if isinstance(v, six.string_types):
+ tags.add(v)
+ elif isinstance(v, (list, tuple)):
+ for val in v:
+ tags.add(val)
else:
args.append("--{0}={1}".format(k,v))
if k == 'notify' and v is True:
args.append("--notify")
- args.append("--tags={0}".format(','.join(tags)))
+ args.append("--tags={0}".format(','.join(filter(None,tags))))
if inplace_args is not None:
if cmd_type == 'hadoopcmd':