Граф коммитов

6751 Коммитов

Автор SHA1 Сообщение Дата
Kaxil Naik bc4bb30588
Fix docstrings for Kubernetes Backcompat module (#12422)
This were missed in https://github.com/apache/airflow/pull/12384
2020-11-18 01:01:19 +00:00
Kaxil Naik 506ee1f06c
Fix issues with Gantt View (#12419)
closes https://github.com/apache/airflow/issues/9813
closes https://github.com/apache/airflow/issues/9633

and does some cleanup
2020-11-17 21:50:39 +00:00
Daniel Imberman cab86d80d4
Make K8sPodOperator backwards compatible (#12384)
* Make the KubernetesPodOperator backwards compatible

This PR significantly reduces the pain of upgrading to Airflow 2.0
for users of the KubernetesPodOperator. Users will be allowed to
    continue using the airflow.kubernetes custom classes

* spellcheck

* spelling

* clean up unecessary files in 1.10

* clean up unecessary files in 1.10

* clean up unecessary files in 1.10
2020-11-17 13:47:18 -08:00
Ryan Hamilton a80a320ab9
Don't display when None (#12415) 2020-11-17 15:51:15 -05:00
Kaxil Naik bf3ead13cc
Change log level for User's session to DEBUG (#12414)
This line was logged too often -- too chatty
2020-11-17 21:48:24 +01:00
Tomek Urbaszek a4aa32b875
Simplify using XComArg in jinja template string (#12405)
This changes XComArg string representation from 'task_instance.pull(...)'
to '{{ task_instance.xcom_pull(...) }}' so users can use XComArgs with
f-string (and other) in simpler way. Instead of doing
f'echo {{{{ {op.output} }}}}' they can simply do f'echo {op.output}'.
2020-11-17 19:35:12 +01:00
Jarek Potiuk 2c0920fba5
Adds mechanism for provider package discovery. (#12383)
This is a simple mechanism that will allow us to dynamically
discover and register all provider packages in the Airflow core.

Closes: #11422
2020-11-17 18:48:57 +01:00
Kamil Breguła 2cda2f2a0a
Add missing pre-commit definition - provider-yamls (#12393) 2020-11-17 15:44:46 +01:00
Tobiasz Kędzierski 80a957f142
Add Dataflow sensors - job metrics (#12039) 2020-11-17 11:43:13 +01:00
Jarek Potiuk ae7cb4a1e2
Update wrong commit hash in backport provider changes (#12390)
The commit was rebased so hash changed. This restores the right one.
2020-11-17 10:29:14 +01:00
Xiaodong DENG 35b5614817
Remove inapplicable configuration section [ldap] (since 2.0.0) (#12386)
[ldap] section in airflow.cfg is not applicable anymore in 2.0 and master,
because the LDAP authentication (for webserver and API) is handled by FAB,
and the configuration for this is handled by webserver_config.py file.
2020-11-16 21:34:20 +01:00
James Timmins d4e1ff290f
Handle outdated webserver session timeout gracefully. (#12332) 2020-11-16 19:38:28 +00:00
Tomek Urbaszek 1623df8721
Use different deserialization method in XCom init_on_load (#12327)
The init_on_load method used deserialize_value method which
in case of custom XCom backends may perform requests to external
services (for example downloading file from buckets).

This is problematic because wherever we query XCom the resuest would be
send (for example when listing XCom in webui). This PR proposes implementing
orm_deserialize_value which allows overriding this behavior. By default
we use BaseXCom.deserialize_value.

closes: #12315
2020-11-16 13:32:36 +01:00
Tomek Urbaszek 917e6c4424
Add provide_file_and_upload to GCSHook (#12310)
This commit adds provide_file_and_upload context manager
which works similar to provide_file. Users using it can
avoid boilerplate code of creating temporary file and then
uploading its content to GCS.
2020-11-16 10:46:34 +01:00
John Bampton 6f0cf3f724
Remove unneeded parentheses after Black formatting (#12380) 2020-11-16 09:24:54 +00:00
Ash Berlin-Taylor 6d05108fed
Add info log message about duration taken to load plugins (#12308)
Loading plugins, particularly from setuptools entry points can be slow,
and since by default this happens per-task, it can slow down task
execution unexpectedly.

By having this log message users can know the source of the delay

(The change to test_standard_task_runner was to remove logging-config
side effects from that test)
2020-11-16 09:03:43 +00:00
Xiaodong DENG 561e459491
Proper exit status for failed CLI requests (#12375)
Some CLI commands simply print messages when the requests fail.
The issue is the exit code for these commands are 0 while it should be non-zero.

Pursuing very detailed status code may not make sense here.
But we can at least ensure we give non-zero status by using raise SystemExit().

More proper exist status ensures people can better make use of the CLI.

(A few minor string expression issues are fixed here as well).
2020-11-15 21:39:14 +01:00
Tobiasz Kędzierski cfa4ecfeb0
Add DataflowJobStatusSensor and support non-blocking execution of jobs (#11726) 2020-11-15 20:54:05 +01:00
Tomek Urbaszek 39ea8722c0
Check for TaskGroup in _PythonDecoratedOperator (#12312)
Crucial feature of functions decorated by @task is to be able
to invoke them multiple times in single DAG. To do this we are
generating custom task_id for each invocation. However, this didn't
work with TaskGroup as the task_id is already altered by adding group_id
prefix. This PR fixes it.

closes: #12309

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
2020-11-15 12:28:04 +01:00
Xiaodong DENG 823b3aace2
Reject 'connections add' CLI request if URI provided is invalid (#12370)
The validity is decided by availability of both 'scheme' and 'netloc' in the parse result
2020-11-15 11:47:57 +01:00
Kamil Breguła 6889a333cf
Improvements for operators and hooks ref docs (#12366) 2020-11-15 00:50:30 +01:00
Daniel Imberman 221f809c1b
Fix full_pod_spec for k8spodoperator (#12354)
* Fix full_pod_spec for k8spodoperator

Fixes a bug where the `full_pod_spec` argument is never factored
into the kubernetespodoperator. The new order of operations is as
follows:

1. Check to see if there is a pod_template_file and if so create the initial pod, else start with empty pod
2. if there is a full_pod_spec , reconcile the pod_template_file pod and the full_pod_spec pod
3.  reconcile with any of the argument overrides

* add tests
2020-11-14 11:32:34 -08:00
Tomek Urbaszek bcb2437343
Remove redundant method in KubernetesExecutor (#12317)
The _inject_secrets method was invoked but it performed no action so
it seems that we can remove it.
2020-11-14 16:39:34 +01:00
Kaxil Naik 9e7b7efb69
Reorder Database Migrations (#12362)
Becase `2c6edca13270` (Resource based permissions) & `849da589634d` (Prefix DAG permissions)
were run before `92c57b58940d_add_fab_tables.py` and `03afc6b6f902_increase_length_of_fab_ab_view_menu_.py`,
the FAB tables were already created because those migrations imported `from airflow.www.app import create_app`
which calls the following lines that creates tables:

0e7f62418b/flask_appbuilder/security/sqla/manager.py (L86-L97)

Previously:

```
INFO  [alembic.runtime.migration] Running upgrade bef4f3d11e8b -> 98271e7606e2, Add scheduling_decision to DagRun and DAG
INFO  [alembic.runtime.migration] Running upgrade 98271e7606e2 -> 52d53670a240, fix_mssql_exec_date_rendered_task_instance_fields_for_MSSQL
INFO  [alembic.runtime.migration] Running upgrade 52d53670a240 -> 849da589634d, Prefix DAG permissions.
[2020-11-14 02:35:43,055] {manager.py:727} WARNING - No user yet created, use flask fab command to do it.
[2020-11-14 02:35:46,790] {migration.py:515} INFO - Running upgrade 849da589634d -> 364159666cbd, Add creating_job_id to DagRun table
[2020-11-14 02:35:46,794] {migration.py:515} INFO - Running upgrade 364159666cbd -> 2c6edca13270, Resource based permissions.
[2020-11-14 02:35:46,795] {app.py:87} INFO - User session lifetime is set to 43200 minutes.
[2020-11-14 02:35:46,806] {manager.py:727} WARNING - No user yet created, use flask fab command to do it.
[2020-11-14 02:35:48,221] {migration.py:515} INFO - Running upgrade 2c6edca13270 -> 45ba3f1493b9, add-k8s-yaml-to-rendered-templates
[2020-11-14 02:35:48,226] {migration.py:515} INFO - Running upgrade 45ba3f1493b9 -> 92c57b58940d, Create FAB Tables
[2020-11-14 02:35:48,227] {migration.py:515} INFO - Running upgrade 92c57b58940d -> 03afc6b6f902, Increase length of FAB ab_view_menu.name column
```

Now:

```
INFO  [alembic.runtime.migration] Running upgrade bef4f3d11e8b -> 98271e7606e2, Add scheduling_decision to DagRun and DAG
INFO  [alembic.runtime.migration] Running upgrade 98271e7606e2 -> 52d53670a240, fix_mssql_exec_date_rendered_task_instance_fields_for_MSSQL
INFO  [alembic.runtime.migration] Running upgrade 52d53670a240 -> 364159666cbd, Add creating_job_id to DagRun table
INFO  [alembic.runtime.migration] Running upgrade 364159666cbd -> 45ba3f1493b9, add-k8s-yaml-to-rendered-templates
INFO  [alembic.runtime.migration] Running upgrade 45ba3f1493b9 -> 92c57b58940d, Create FAB Tables
INFO  [alembic.runtime.migration] Running upgrade 92c57b58940d -> 03afc6b6f902, Increase length of FAB ab_view_menu.name column
INFO  [alembic.runtime.migration] Running upgrade 03afc6b6f902 -> 849da589634d, Prefix DAG permissions.
[2020-11-14 02:57:18,886] {manager.py:727} WARNING - No user yet created, use flask fab command to do it.
[2020-11-14 02:57:22,380] {migration.py:515} INFO - Running upgrade 849da589634d -> 2c6edca13270, Resource based permissions.
```
2020-11-14 09:13:33 +00:00
Ace Haidrey f32497395a
Add success/failed sets to State class (#12359)
Co-authored-by: Ace Haidrey <ahaidrey@pinterest.com>
2020-11-14 09:22:32 +01:00
Martijn Pieters 4c25e76360
Refactor root logger handling in task run (#12342)
- Use a context manager to encapsulate task logging setup and teardown
- Create a copy, not a reference, of the handlers list
- Remove logging.shutdown(), it simply should not be called

Closes #12090
2020-11-14 04:10:08 +00:00
Kaxil Naik 3a72fc8247
Fix Description of Provider Docs (#12361)
Apache Druid had description for Cassandra. Dingding had it for Datadog. And typo in Vertica
2020-11-14 03:55:43 +00:00
Kaxil Naik 02ef8e1cb3
Manage Flask AppBuilder Tables using Alembic Migrations (#12352)
closes https://github.com/apache/airflow/issues/9155

The Migration is idempotent and allows both upgrade and downgrade.
It also takes care of https://github.com/dpgaspar/Flask-AppBuilder/pull/1368
i.e. increasing the length of ab_view_menu.name column from 100 to 250
2020-11-14 03:25:36 +00:00
Ryan Hamilton ba76eb4961
Make nav fully accessible y keyboard, fix mobile nav menus (#12351) 2020-11-13 18:50:42 -05:00
Ace Haidrey aac3877ec3
Add metric for scheduling delay between first run task & expected start time (#9544)
Co-authored-by: Ace Haidrey <ahaidrey@pinterest.com>
2020-11-13 23:03:42 +01:00
Daniel Imberman 4e362c1347
K8s yaml templates not rendered by k8sexecutor (#12303)
* K8s yaml templates not rendered by k8sexecutor

There is a bug in the yaml template rendering caused by the logic that
yaml templates are only generated when the current executor is the
k8sexecutor. This is a problem as the templates are generated by the
task pod, which is itself running a LocalExecutor. Also generates a
"base" template if this taskInstance has not run yet.

* fix tests

* fix taskinstance test

* fix taskinstance

* fix pod generator tests

* fix podgen

* Update tests/kubernetes/test_pod_generator.py

Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>

* @ashb comment

Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>
2020-11-13 12:06:29 -08:00
Martijn Pieters d54f087b66
Use the backend-configured model (#12336)
Rather than import the backend Task model directly, use the class that the backend actually uses. This could have been customised, and there is no reason not to use this reference.
2020-11-13 19:58:45 +01:00
Ephraim Anierobi 3e4aa06617
Bugfix: REST API Variables update endpoint returns 204 No Content (#12321) 2020-11-13 17:58:09 +00:00
Ryan Hamilton e5e47dac47
Fix/Enhancement: Disable forms and communicate to user when no DAG Runs (#12320)
* Disable forms and communicate to user when no DAG runs yet

* Refactor method name to not use negation in name

* lint fix
2020-11-13 12:46:59 -05:00
Ryan Hamilton 450bd32082
Improve presentation of DAG Docs (#12330)
* Improve presentation of DAG docs

* syntax fix
2020-11-13 12:35:24 -05:00
Nicolas Lecoy 309b325c17
Update deprecated Apache Pinot Broker API (#12333)
* Update depricated Apache Pinot Broker API

* Fix typo on Pinot Hook
2020-11-13 16:48:06 +01:00
Tomek Urbaszek 1222ebd4e1
Create DAG-level cluster policy (#12184)
This commit adds new concept of dag_policy which is checked
once for every DAG when creating DagBag. It also improves
documentation around cluster policies.

closes: #12179

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>
2020-11-13 14:32:49 +01:00
João Ponte c94b1241a1
Add extra error handling to S3 remote logging (#9908)
If you have configured S3 logs, but there is a problem then this is never
surfaced to the UI (nor the webserver logs) making this very hard to
debug.

This PR exposes some of these errors to the user.

Co-authored-by: Joao Ponte <jpe@plista.com>
Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>
2020-11-13 13:04:59 +00:00
Kamil Breguła 7825e8f590
Docs installation improvements (#12304)
* Improvements for installation docs
2020-11-13 09:38:54 +01:00
Trinity Xia b027223132
Add install/uninstall api to databricks hook (#12316)
- adding install Databricks API to databricks hook(api/2.0/libraries/install)

- adding uninstall Databricks API to databricks hook (2.0/libraries/uninstall)
2020-11-13 07:41:31 +01:00
Kaxil Naik 75f25bd8b9
Fix and Unquarantine test_change_state_for_tis_without_dagrun (#12323)
The test was simply wrong and failed since the new logic was added in
c9a97baa86
2020-11-13 05:18:44 +00:00
Nathan Hadfield 32b59f8350
Fixes the sending of an empty list to BigQuery `list_rows` (#12307)
* Fixes an issue that was causing an empty list being sent to the BigQuery client `list_rows` method resulting in no schema being returned.

* Added a test to check that providing an empty list for `selected_fields` results in `list_rows` being called wth `None`.
2020-11-12 23:47:00 +01:00
Ryan Hamilton 7f828b03cc
Get all "tags" parameters not just one (#12324) 2020-11-12 16:45:25 -05:00
Kaxil Naik 5d5c119187
Remove deprecated Elasticsearch Configs (#12296)
Since Airflow 1.10.4 we have removed `elasticsearch_` prefix from all
config items under `[elasticsearch]` section. It is time we remove them
from 2.0.

https://github.com/apache/airflow/blob/1.10.4/UPDATING.md#changes-in-writing-logs-to-elasticsearch
2020-11-12 12:47:16 +00:00
Kaxil Naik ae93fdbabc
Remove deprecated BashTaskRunner (#12295)
This commit:

- Remove support for BashTaskRunner, this task_runner was deprecated from
Airflow 1.10.3 (https://github.com/apache/airflow/blob/1.10.3/UPDATING.md#rename-of-bashtaskrunner-to-standardtaskrunner)

- Support deprecated `hostname_callable` & `email_backedn` until 2.1 since it has not been deprecated in any relased Airflow versions
2020-11-12 12:46:50 +00:00
kukigai af2f2e8c29
Wait option for dagrun operator (#12126)
* Add wait_for_completion option to dag run operator.

* Add wait_for_completion option to dag run operator.

* Change code format to pass sanity check.

* Simplify the logic to check dag run state.

* Move sleep in the beginning of loop and update pydoc.

* Change elif to if on checking allowed_states

Co-authored-by: Kaz Ukigai <kukigai@apple.com>
2020-11-12 12:21:29 +01:00
Peter Kosztolanyi 9276607b58
Add session_parameters option to snowflake_hook (#12071) 2020-11-12 00:30:14 +00:00
Tomek Urbaszek 289c9b5a99
Use default view in TriggerDagRunLink (#11778) 2020-11-11 23:11:53 +01:00
Ephraim Anierobi 7478e18ee5
Handle naive datetimes in REST APIi (#12248) 2020-11-11 20:10:44 +01:00
Ephraim Anierobi 0d37c59669
Make dag_id, task_id, and execution_date nullable in event log schema (#12287) 2020-11-11 20:10:13 +01:00