Skip to content

Commit

Permalink
[AIRFLOW-525] Update template_fields in Qubole Op
Browse files Browse the repository at this point in the history
There were couple of more fields in Qubole
Operator which requires
support of Jinja templating, so added these missed
out fields as well
to template_fields. Also added a missing doc
(about notify) and an
example of using macros.

Closes apache#1808 from msumit/AIRFLOW-525
  • Loading branch information
msumit authored and r39132 committed Sep 29, 2016
1 parent f0db42c commit 8ca8f66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions airflow/contrib/example_dags/example_qubole_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def compare_result(ds, **kwargs):
script_location="s3n://public-qubole/qbol-library/scripts/show_table.hql",
notfiy=True,
tags=['tag1', 'tag2'],
# If the script at s3 location has any qubole specific macros to be replaced
# macros='[{"date": "{{ ds }}"}, {"name" : "abc"}]',
trigger_rule="all_done",
dag=dag)

Expand Down
10 changes: 7 additions & 3 deletions airflow/contrib/operators/qubole_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class QuboleOperator(BaseOperator):
:tags: array of tags to be assigned with the command
:cluster_label: cluster label on which the command will be executed
:name: name to be given to command
:notify: whether to send email on command completion or not (default is False)
**Arguments specific to command types**
Expand Down Expand Up @@ -100,8 +101,9 @@ class QuboleOperator(BaseOperator):
.. note:: Following fields are template-supported : ``query``, ``script_location``,
``sub_command``, ``script``, ``files``, ``archives``, ``program``, ``cmdline``,
``sql``, ``where_clause``, ``extract_query``, ``boundary_query``, ``macros``,
``tags``, ``name``, ``parameters``. You can also use ``.txt`` files for template
driven use cases.
``tags``, ``name``, ``parameters``, ``dbtap_id``, ``hive_table``, ``db_table``,
``split_column``, ``db_update_keys``, ``export_dir``, ``partition_spec``. You
can also use ``.txt`` files for template driven use cases.
.. note:: In QuboleOperator there is a default handler for task failures and retries,
which generally kills the command running at QDS for the corresponding task
Expand All @@ -111,7 +113,9 @@ class QuboleOperator(BaseOperator):

template_fields = ('query', 'script_location', 'sub_command', 'script', 'files',
'archives', 'program', 'cmdline', 'sql', 'where_clause', 'tags',
'extract_query', 'boundary_query', 'macros', 'name', 'parameters')
'extract_query', 'boundary_query', 'macros', 'name', 'parameters',
'dbtap_id', 'hive_table', 'db_table', 'split_column',
'db_update_keys', 'export_dir', 'partition_spec')
template_ext = ('.txt',)
ui_color = '#3064A1'
ui_fgcolor = '#fff'
Expand Down

0 comments on commit 8ca8f66

Please sign in to comment.