pierrejeambrun commented on code in PR #44051:
URL: https://github.com/apache/airflow/pull/44051#discussion_r1843766159
##########
tests/api_fastapi/core_api/routes/public/test_task_instances.py:
##########
@@ -1127,3 +1127,283 @@ def test_should_respond_dependencies_mapped(self,
test_client, session):
"print_the_context/0/dependencies",
)
assert response.status_code == 200, response.text
+
+
+class TestGetTaskInstancesBatch(TestTaskInstanceEndpoint):
+ @pytest.mark.parametrize(
+ "task_instances, update_extras, payload, expected_ti_count",
+ [
+ pytest.param(
+ [
+ {"queue": "test_queue_1"},
+ {"queue": "test_queue_2"},
+ {"queue": "test_queue_3"},
+ ],
+ True,
+ {"queue": ["test_queue_1", "test_queue_2"]},
+ 2,
+ id="test queue filter",
+ ),
+ pytest.param(
+ [
+ {"executor": "test_exec_1"},
+ {"executor": "test_exec_2"},
+ {"executor": "test_exec_3"},
+ ],
+ True,
+ {"executor": ["test_exec_1", "test_exec_2"]},
+ 2,
+ id="test executor filter",
+ ),
+ pytest.param(
+ [
+ {"duration": 100},
+ {"duration": 150},
+ {"duration": 200},
+ ],
+ True,
+ {"duration_gte": 100, "duration_lte": 200},
+ 3,
+ id="test duration filter",
+ ),
+ pytest.param(
+ [
+ {"execution_date": DEFAULT_DATETIME_1},
Review Comment:
Yes this is not great. The reason is because this dictionary is used to
instantiate a `TI` and create it in the database. (With `setattr(attr, value)`
construct). I don't think `logical_date` exists on the TI ORM model.
This piece is coming from the legacy code, maybe there is a better way now
to set the `logical_date` on a task instance without using the association
proxy `execution_date` ?
The next dictionary, which uses `logical_date` is actually the request
payload, send by the client, which exposes a `logical_date` and not the
deprecated `execution_date`.
--
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]