ashb commented on a change in pull request #17485:
URL: https://github.com/apache/airflow/pull/17485#discussion_r701835492
##########
File path: airflow/models/taskinstance.py
##########
@@ -505,7 +515,13 @@ def generate_command(
:type task_id: str
:param execution_date: Execution date for the task
:type execution_date: datetime
+ :param mark_as: Mark the task as being in the given state.
+ :type mark_as: .TaskInstanceState
:param mark_success: Whether to mark the task as successful
+ .. deprecated: 2.1.3
Review comment:
```suggestion
.. deprecated: 2.2.0
```
##########
File path: airflow/jobs/backfill_job.py
##########
@@ -146,8 +148,15 @@ def __init__(
:type start_date: datetime.datetime
:param end_date: end date for the backfill date range.
:type end_date: datetime.datetime
+ :param mark_as: Mark the task as being in the given state.
+ Value must be one of :class:`.TaskInstanceState`.
+ :type mark_as: .TaskInstanceState
:param mark_success: flag whether to mark the task auto success.
- :type mark_success: bool
+ :type mark_success: airflow.utils.state.State
+ .. deprecated: 2.1.3
Review comment:
```suggestion
.. deprecated: 2.2.0
```
##########
File path: airflow/models/taskinstance.py
##########
@@ -1052,6 +1098,14 @@ def check_and_change_state_before_execution(
:return: whether the state was changed to running or not
:rtype: bool
"""
+ if mark_success is not None:
+ warnings.warn(
+ 'The argument `mark_success` has been deprecated. Use
`state=State.SUCCESS` instead.',
+ DeprecationWarning,
Review comment:
```suggestion
DeprecationWarning,
stacklevel=3
```
(+1 for the `@provide_session`)
##########
File path: airflow/models/dag.py
##########
@@ -1939,7 +1940,13 @@ def run(
:type start_date: datetime.datetime
:param end_date: the end date of the range to run
:type end_date: datetime.datetime
+ :param mark_as: Mark the task as being in the given state.
+ :type mark_as: .TaskInstanceState
:param mark_success: True to mark jobs as succeeded without running
them
+ .. deprecated: 2.1.3
Review comment:
```suggestion
.. deprecated: 2.2.0
```
##########
File path: airflow/models/taskinstance.py
##########
@@ -1187,6 +1248,14 @@ def _run_raw_task(
:param session: SQLAlchemy ORM Session
:type session: Session
"""
+ if mark_success is not None:
+ warnings.warn(
+ 'The argument `mark_success` has been deprecated. Use
`state=State.SUCCESS` instead.',
+ DeprecationWarning,
Review comment:
```suggestion
DeprecationWarning,
stacklevel=3,
```
##########
File path: airflow/models/taskinstance.py
##########
@@ -1390,20 +1459,29 @@ def run(
ignore_depends_on_past: bool = False,
ignore_task_deps: bool = False,
ignore_ti_state: bool = False,
- mark_success: bool = False,
+ mark_as: Optional[TaskInstanceState] = None,
+ mark_success: Optional[bool] = None,
test_mode: bool = False,
job_id: Optional[str] = None,
pool: Optional[str] = None,
session=None,
) -> None:
"""Run TaskInstance"""
+ if mark_success is not None:
+ warnings.warn(
+ 'The argument `mark_success` has been deprecated. Use
`state=State.SUCCESS` instead.',
+ DeprecationWarning,
Review comment:
```suggestion
DeprecationWarning,
stacklevel=3,
```
##########
File path: airflow/models/taskinstance.py
##########
@@ -1039,7 +1079,13 @@ def check_and_change_state_before_execution(
:type ignore_task_deps: bool
:param ignore_ti_state: Disregards previous task instance state
:type ignore_ti_state: bool
+ :param mark_as: Don't run the task, mark it as being in the given
state.
+ :type mark_as: .TaskInstanceState
:param mark_success: Don't run the task, mark its state as success
+ .. deprecated: 2.1.3
Review comment:
```suggestion
.. deprecated: 2.2.0
```
##########
File path: airflow/models/taskinstance.py
##########
@@ -1178,7 +1233,13 @@ def _run_raw_task(
completion and runs any post-execute callbacks. Meant to be called
only after another function changes the state to running.
+ :param mark_as: Don't run the tasks, mark it with the given state.
+ :type: mark_as: .TaskInstanceState
:param mark_success: Don't run the task, mark its state as success
+ .. deprecated: 2.1.3
Review comment:
```suggestion
.. deprecated: 2.2.0
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]