uranusjr opened a new pull request, #24732:
URL: https://github.com/apache/airflow/pull/24732

   First part of #24699 (the other would be to fix the web UI). This adds the 
ability to clear one specific mapped task’s state via the REST API.
   
   This is a bit more complicated than I’d desired. Currently the 
`clearTaskInstance` endpoint accepts a `task_ids` field that takes a list of 
strings to filter out specific tasks. To make this support map indexes, I first 
tried the followings:
   
   ```js
   {
       "task_ids": [
           "task_1",  # Clearing the entire task, multiple tis if mapped.
           ["task_2", 1],  # Clearing one specific ti.
       ],
   }
   ```
   
   But this does not work since it requires using the new `prefixItems` key to 
specify an array as tuple, which was added in Open API 3.1, but we’re still on 
3.0.
   
   Next I tried
   
   ```js
   {
       "task_ids": [
           "task_1",
           {"task_id": "task_2", "map_index": 1},
       ],
   }
   ```
   
   I don’t like duplicating `task_id` inside the nested object, but even this 
does not work, since Open API 3.0 also forbids heterogeneous arrays.
   
   So in the end I added a new field `tasks` instead, that only accepts the 
object form, and merge `task_ids` and `tasks` in the backend instead. In the 
future, once we are able to use heterogeneous arrays, we could merge the two 
fields back into one property to clean up the interface. For now though, this 
is what we need to do.


-- 
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]

Reply via email to