uranusjr commented on code in PR #22958:
URL: https://github.com/apache/airflow/pull/22958#discussion_r848814266
##########
airflow/api/common/mark_tasks.py:
##########
@@ -79,6 +79,7 @@ def _create_dagruns(
def set_state(
*,
tasks: Iterable[Operator],
+ map_indexes: Optional[Iterable[int]] = None,
Review Comment:
I thought about this a while ago, passing these as two arguments seems wrong
because generally it only makes sense if either `tasks` are all non-mapped, or
contain only one task. It makes very little sense to do something like
```python
set_state(tasks=[task_1, task_2], map_indexes=[1, 3])
```
Instead, we should probably make `tasks` take 2-tuples like this:
```python
set_state(
tasks=[
(task_1, 2), # The specific mapped ti.
task_2, # The one ti if task_2 is not mapped, or all tis if mapped.
],
)
```
That would involve a larger change though, or at least that’s my impression
when I last looked into this (before I got distracted by other issues).
##########
airflow/api/common/mark_tasks.py:
##########
@@ -79,6 +79,7 @@ def _create_dagruns(
def set_state(
*,
tasks: Iterable[Operator],
+ map_indexes: Optional[Iterable[int]] = None,
Review Comment:
I thought about this a while ago, passing these as two arguments seems wrong
because generally it only makes sense if either `tasks` are all non-mapped, or
contain only one task. It makes very little sense to do something like
```python
set_state(tasks=[task_1, task_2], map_indexes=[1, 3])
```
Instead, we should probably make `tasks` take 2-tuples like this:
```python
set_state(
tasks=[
(task_1, 2), # The specific mapped ti.
task_2, # The one ti if task_2 is not mapped, or all tis if mapped.
],
)
```
This would involve a larger change though, or at least that’s my impression
when I last looked into this (before I got distracted by other issues).
--
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]