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

112 Коммитов

Автор SHA1 Сообщение Дата
Géraud 92727f751c [AIRFLOW-2508] Handle non string types in Operators templatized fields (#4292) 2019-01-23 13:02:04 +00:00
Kamil Breguła 304cb9e685 [AIRFLOW-3744] Abandon the use of obsolete aliases of methods (#4568) 2019-01-22 15:45:12 -08:00
Joshua Carp bd74ddaf34 [AIRFLOW-3383] Rotate fernet keys. (#4225)
Add the ability to change the encryption key of all encrypted variables and
connections
2019-01-21 11:12:38 +00:00
Stefan Seelmann 5abd19e250 [AIRFLOW-3591] Fix start date, end date, duration for rescheduled tasks (#4502)
* Use first start date when running a rescheduled task, this also fixes
  the duration. Use actual start date to record reschedule requests.
* Simplify gantt view code now that start date and duration are correct
  in `task_instance` table
2019-01-18 17:00:42 +00:00
Verdan Mahmood c030729dcb [AIRFLOW-3303] Deprecate old UI in favor of FAB (#4339) 2019-01-14 14:33:45 +00:00
Joshua Carp 86ba44d391 [AIRFLOW-3584] Use ORM DAGs for index view. (#4390)
* [AIRFLOW-3584] Use ORM DAGs for index view.

* Serialize schedule interval to json rather than pickle.
2019-01-11 11:18:00 +01:00
marengaz 657b986165 [AIRFLOW-3207] Option to push result to xcom (#4056) 2019-01-11 10:23:02 +01:00
Xiaodong 0d5c127d72 [AIRFLOW-3606] Fix Flake8 test & fix the Flake8 errors introduced since Flake8 test was broken (#4415)
The flake8 test in the Travis CI was broken since https://github.com/apache/incubator-airflow/pull/4361
(7a6acbf5b3 )

And some Flake8 errors (code style/quality issues. found in 10 files) were introduce since flake8 test was broken.
2019-01-01 22:49:38 -08:00
Peter van 't Hof 53e7074288 [AIRFLOW-3573] Remove DagStat table (#4378)
* Remove DagStat usage

* Remove tests

* Remove dag_stat table from db

* Removed dagstat class

* Revert change

* Fixing test
2018-12-30 10:51:19 +01:00
Peter van 't Hof 0cc078a86d [AIRFLOW-3561] Improve queries (#4368)
* improve queries

* Adding field to the database

* Set length of field

* remove dagbag use in xcom call

* Fixing typo

* Adding test

* Remove default_view

* fixing test

* rename var

* Fixing rbac dag_stats

* Fixing rbac task_stats

* Fixing rbac code

* Fixing rbac xcom

* Fixing template

* Fixing default view call

* Added timezone to DagModel

* Fixing timezone
2018-12-27 08:32:00 +01:00
BasPH 3be104bce8 [AIRFLOW-3557] Fix various typos (#4357) 2018-12-22 18:07:29 +00:00
BasPH c9a82d48a3 [AIRFLOW-3458] Move models.Connection into separate file (#4335) 2018-12-20 13:15:37 +01:00
Ash Berlin-Taylor 5e1304a7c0
[AIRFLOW-3339] Correctly get DAG timezone when start_date in default_args (#4186) 2018-11-14 21:35:03 +00:00
Alek Storm a25917e947 [AIRFLOW-1262] Allow configuration of email alert subject and body (#2338) 2018-11-14 21:12:31 +00:00
Marcin Szymański 4cdeefb85f [AIRFLOW-3245] fix list processing in resolve_template_files (#4086)
* [AIRFLOW-3245] fix list processing in resolve_template_files

* [AIRFLOW-3245] add tests

* [AIRFLOW-3245] modify tests
2018-11-13 14:37:56 +01:00
Ethan Vizitei 62942086e5 [AIRFLOW-2865] Call success_callback before updating task state (#4082)
In cases where the success callback takes variable
time, it's possible for it to interrupted by the heartbeat process.
This is because the heartbeat process looks for tasks that are no
longer in the "running" state but are still executing and reaps them.

This commit reverses the order of callback invocation and state
updating so that the "SUCCESS" state for the task isn't committed
to the database until after the success callback has finished.
2018-11-05 17:24:55 +00:00
bolkedebruin ca866e79cf [AIRFLOW-3277] Correctly observe DST transitions for cron (#4117)
`following_schedule` converts to naive time by using the
local time zone. In case of a DST transition, say 3AM -> 2AM
("summer time to winter time") we incorrectly re-applied
the timezone information which meant that a "CEST -> CEST"
could happen instead of a "CEST -> CET". This resulted
in infinite loops.
2018-11-05 11:16:20 +00:00
Jarek Potiuk 3ea61de785 [AIRFLOW-3264] URL decoding when parsing URI for connection (#4109)
Full URL decoding is performed now when parsing different
components of URI for connection. This enables to configure
paths to sockets including (for example ":") - so far
only '/' (%2f) was hard-coded in hostname. This change introduces
full decoding for all components of the URI.

Note that this is potentially breaking change if someone uses
% in some of their AIRFLOW_CONN_ defined connections.
2018-10-28 22:37:46 -07:00
Jarek f95c7b4639 [AIRFLOW-1970] Let empty Fernet key or special `no encryption` phrase. (#4038)
Once the user has installed Fernet package then the application enforces setting valid Fernet key.
This change will alter this behavior into letting empty Fernet key or special `no encryption` phrase and interpreting those two cases as no encryption desirable.
2018-10-26 14:29:00 +02:00
Kevin Yang 75e2288a3f [Airflow-2760] Decouple DAG parsing loop from scheduler loop (#3873) 2018-10-26 09:37:10 +01:00
Jason Shao 39a9365b62 [AIRFLOW-3238] Fix models.DAG to deactivate unknown DAGs on initdb (#4073)
Unknown dags are now deactivated on initdb
2018-10-21 21:52:13 +01:00
Fokko Driesprong 0e8394fd23 [AIRFLOW-3190] Make flake8 compliant (#4035)
Enforce Flake8 over the entire project
2018-10-12 22:22:52 +01:00
Eric Chang 6f833544c1 [AIRFLOW-3161] fix TaskInstance log link in RBAC UI 2018-10-04 20:29:06 -07:00
Joshua Carp c7be7af9d9 [AIRFLOW-3129] Improve test coverage of airflow.models. (#3982) 2018-10-01 11:15:20 +01:00
Ash Berlin-Taylor f101352056 [AIRFLOW-XXX] Speed up DagBagTest cases (#3974)
I noticed that many of the tests of DagBags operate on a specific DAG
only, and don't need to load the example or test dags. By not loading
the dags we don't need to this shaves about 10-20s of test time.
2018-09-29 08:33:11 +01:00
Newton Le bcc49ab14f [AIRFLOW-3123] Use a stack for DAG context management (#3956) 2018-09-28 12:51:34 -04:00
Fokko Driesprong 491fd743da [AIRFLOW-2918] Remove unused imports 2018-09-21 13:21:42 -07:00
Newton Le f9d83d4208 [AIRFLOW-3060] DAG context manager fails to exit properly in certain circumstances 2018-09-13 20:59:27 -04:00
Kaxil Naik b7f33a7310 [AIRFLOW-3006] Add note on using None for schedule_interval 2018-09-05 10:14:55 -07:00
abdul-stripe f27915150f [AIRFLOW-2145] fix deadlock on clearing running TI (#3657)
a `shutdown` task is not considered be `unfinished`, so a dag run can
deadlock when all `unfinished` downstreams are all waiting on a task
that's in the `shutdown` state. fix this by considering `shutdown` to
be `unfinished`, since it's not truly a terminal state
2018-09-01 00:52:02 +01:00
Yingbo Wang b4f1c73f8e [AIRFLOW-2951] Update dag_run table end_date when state change (#3798)
The existing airflow only change dag_run table end_date value when
a user teminate a dag in web UI. The end_date will not be updated
if airflow detected a dag finished and updated its state.

This commit add end_date update in DagRun's set_state function to
make up tho problem mentioned above.
2018-09-01 00:49:39 +01:00
bolkedebruin 6c8d35c44f
[AIRFLOW-2984] Convert operator dates to UTC (#3822)
Tasks can have start_dates or end_dates separately
from the DAG. These need to be converted to UTC otherwise
we cannot use them for calculation the next execution
date.
2018-08-30 14:26:11 +02:00
Kazuhiro Sera b78c7fb851 [AIRFLOW-2889] Fix typos detected by github.com/client9/misspell (#3732) 2018-08-11 21:11:19 -07:00
Xiaodong d47580feaf [AIRFLOW-2855] Check Cron Expression Validity in DagBag.process_file() (#3698)
A DAG can be imported as a .py script properly,
but the Cron expression inside as "schedule_interval" may be
invalid, like "0 100 * * *".

This commit helps check the validity of Cron expression in DAG
files (.py) and packaged DAG files (.zip), and help show
exception messages in web UI by add these exceptions into
metadata "import_error".
2018-08-07 18:07:43 -07:00
Kaxil Naik 120f4856cd [AIRFLOW-2867] Refactor Code to conform standards (#3714)
- Dictionary creation should be written by dictionary literal
- Python’s default arguments are evaluated once when the function is defined, not each time the function is called (like it is in say, Ruby). This means that if you use a mutable default argument and mutate it, you will and have mutated that object for all future calls to the function as well.
- Functions calling sets which can be replaced by set literal are now replaced by set literal
- Replace list literals
- Some of the static methods haven't been set static
- Remove redundant parentheses
2018-08-07 16:18:42 -07:00
George Leslie-Waksman 27b436ed93 AIRFLOW-2787 Allow is_backfill to handle NULL DagRun.run_id (#3629) 2018-08-06 15:45:59 -07:00
Tao feng f3f2eb323f [AIRFLOW-2267] Airflow DAG level access
Make sure you have checked _all_ steps below.

### JIRA
- [x] My PR addresses the following [Airflow JIRA]
(https://issues.apache.org/jira/browse/AIRFLOW/)
issues and references them in the PR title. For
example, "\[AIRFLOW-XXX\] My Airflow PR"
    -
https://issues.apache.org/jira/browse/AIRFLOW-2267
    - In case you are fixing a typo in the
documentation you can prepend your commit with
\[AIRFLOW-XXX\], code changes always need a JIRA
issue.

### Description
- [x] Here are some details about my PR, including
screenshots of any UI changes:
 Provide DAG level access for airflow.  The detail
design could be found at https://docs.google.com/d
ocument/d/1qs26lE9kAuCY0Qa0ga-80EQ7d7m4s-590lhjtMB
jmxw/edit#

### Tests
- [x] My PR adds the following unit tests __OR__
does not need testing for this extremely good
reason:
Unit tests are added.

### Commits
- [x] My commits all reference JIRA issues in
their subject lines, and I have squashed multiple
commits if they address the same issue. In
addition, my commits follow the guidelines from
"[How to write a good git commit
message](http://chris.beams.io/posts/git-
commit/)":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not
"adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

- [x] Passes `git diff upstream/master -u --
"*.py" | flake8 --diff`

Closes #3197 from feng-tao/airflow-2267
2018-07-16 13:13:42 -07:00
Cameron Moberg dc38b2f46d [AIRFLOW-2613] Fix Airflow searching .zip bug
When Airflow was populating a DagBag from a .zip
file, if a single
file in the root directory did not contain the
strings 'airflow' and
'DAG' it would ignore the entire .zip file.

Also added a small amount of logging to not
bombard user with info
about skipping their .py files.

Closes #3505 from Noremac201/dag_name
2018-06-17 19:16:12 +01:00
Sumit Maheshwari df05546f8d [AIRFLOW-437] Send TI context in kill zombies
Fix to provide proper TI context while calling ti.handle_failure during
kill_zombies, as without the context handler_failure is of no use and
its equivalent of marking those TIs as failed directly.

This patch had conflicts when merged, resolved by
Committer: Ash Berlin-Taylor
<ash_github@firemirror.com>

Closes #1796 from msumit/AIRFLOW-437-2
2018-06-08 16:36:20 +01:00
Tao feng c2b962ca98 [AIRFLOW-2558] Clear task/dag is clearing all executions
Closes #3465 from feng-tao/airflow_2588_new
2018-06-05 15:14:43 -07:00
Tao feng 4c6f1fdd61 [AIRFLOW-2537] Add reset-dagrun option to backfill command
Closes #3444 from feng-
tao/add_reset_dagrun_for_backfill
2018-06-01 11:26:23 -07:00
Chao-Han Tsai 2800c8e556 [AIRFLOW-2526] dag_run.conf can override params
Make sure you have checked _all_ steps below.

### JIRA
- [x] My PR addresses the following [Airflow JIRA]
(https://issues.apache.org/jira/browse/AIRFLOW/)
issues and references them in the PR title. For
example, "\[AIRFLOW-XXX\] My Airflow PR"
    -
https://issues.apache.org/jira/browse/AIRFLOW-2526
    - In case you are fixing a typo in the
documentation you can prepend your commit with
\[AIRFLOW-XXX\], code changes always need a JIRA
issue.

### Description
- [x] Here are some details about my PR, including
screenshots of any UI changes:
params can be overridden by the dictionary passed
through `airflow backfill -c`

```
templated_command = """
    echo "text = {{ params.text }}"
"""

bash_operator = BashOperator(
    task_id='bash_task',
    bash_command=templated_command,
    dag=dag,
    params= {
        "text" : "normal processing"
    })
```

In daily processing it prints:
```
normal processing
```

In backfill processing `airflow trigger_dag -c
"{"text": "override success"}"`, it prints
```
override success
```

### Tests
- [ ] My PR adds the following unit tests __OR__
does not need testing for this extremely good
reason:

### Commits
- [x] My commits all reference JIRA issues in
their subject lines, and I have squashed multiple
commits if they address the same issue. In
addition, my commits follow the guidelines from
"[How to write a good git commit
message](http://chris.beams.io/posts/git-
commit/)":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not
"adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

### Documentation
- [x] In case of new functionality, my PR adds
documentation that describes how to use it.
    - When adding new operators/hooks/sensors, the
autoclass documentation generation needs to be
added.

### Code Quality
- [x] Passes `git diff upstream/master -u --
"*.py" | flake8 --diff`

Closes #3422 from milton0825/params-overridden-
through-cli
2018-06-01 11:22:10 -07:00
Shintaro Murakami c6deeb2ff4 [AIRFLOW-1730] Unpickle value of XCom queried from DB 2018-05-25 15:22:09 +09:00
Max Payton ce9c7bbdfc [AIRFLOW-2415] Make airflow DAG templating render numbers
Currently, if you have an operator with a template
fields argument, that is a dictionary, e.g.:
template_fields = ([dict_args])

And you populate that dictionary with a field that
an integer in a DAG, e.g.:
...
dict_args = {'ds': '{{ ds }}', num_times: 5}
...

Then ariflow will give you the following error:
{base_task_runner.py:95} INFO - Subtask:
airflow.exceptions.AirflowException: Type '<type
'int'>' used for parameter 'dict_args[num_times]'
is not supported for templating

This fix aims to resolves that issue by
immediately resolving numbers without attempting
to template them

Closes #3410 from
ArgentFalcon/support_numeric_template_fields
2018-05-24 10:03:31 +02:00
inytar b17a99d714 [AIRFLOW-48] Parse connection uri querystring
Closes #3292 from inytar/extras-in-uri
2018-05-16 10:53:41 +02:00
Bolke de Bruin 1d3bb54707 [AIRFLOW-2351] Check for valid default_args start_date
A bug existed when default_args did contain
start_date
but it was set to None, failing to instantiate the
DAG.

Closes #3256 from bolkedebruin/AIRFLOW-2351
2018-04-23 16:37:55 +02:00
Bolke de Bruin c7a472ed6b [AIRFLOW-2287] Fix incorrect ASF headers
Closes #3219 from bolkedebruin/fix_header
2018-04-14 09:13:23 +02:00
Andrew Stahlman 8c42d03c4e [AIRFLOW-1460] Allow restoration of REMOVED TI's
When a task instance exists in the database but
its corresponding task
no longer exists in the DAG, the scheduler marks
the task instance as
REMOVED. Once removed, task instances stayed
removed forever, even if
the task were to be added back to the DAG.

This change allows for the restoration of REMOVED
task instances. If a
task instance is in state REMOVED but the
corresponding task is present
in the DAG, restore the task instance by setting
its state to NONE.

A new unit test simulates the removal and
restoration of a task from a
DAG and verifies that the task instance is
restored:
`./run_unit_tests.sh tests.models:DagRunTest`

JIRA:
https://issues.apache.org/jira/browse/AIRFLOW-1460

Closes #3137 from astahlman/airflow-1460-restore-
tis
2018-03-21 23:54:05 -07:00
wongwill86 c3730650c8 [AIRFLOW-2203] Defer cycle detection
Moved from adding_task to when dag is being bagged.
This changes import dag runtime from polynomial to somewhat linear.

Closes #3116 from wongwill86:dag_import_speed
2018-03-14 09:13:59 +01:00
Sam Schlegel a0ba5b90b3 [AIRFLOW-2175] Check that filepath is not None
This handles the case where the fileloc no longer exists in the database
2018-03-06 11:48:59 -08:00