amoghrajesh commented on code in PR #45102:
URL: https://github.com/apache/airflow/pull/45102#discussion_r1893535824
##########
task_sdk/tests/execution_time/test_task_runner.py:
##########
@@ -324,6 +287,10 @@ def __init__(self, *args, **kwargs):
for key, value in task_params.items():
setattr(self, key, value)
+ def execute(self, context):
+ for key in self.template_fields:
+ print(key, getattr(self, key))
Review Comment:
Maybe I can remove the print here?
##########
task_sdk/tests/execution_time/test_task_runner.py:
##########
@@ -332,18 +299,28 @@ def __init__(self, *args, **kwargs):
requests_fd=0,
ti_context=make_ti_context(),
)
- mocked_parse(what, "basic_dag", task)
+ ti = mocked_parse(what, "basic_dag", task)
+ instant = timezone.datetime(2024, 12, 3, 10, 0)
+ time_machine.move_to(instant, tick=False)
with mock.patch(
"airflow.sdk.execution_time.task_runner.SUPERVISOR_COMMS", create=True
) as mock_supervisor_comms:
mock_supervisor_comms.get_message.return_value = what
startup()
- mock_supervisor_comms.send_request.assert_called_once_with(
- msg=SetRenderedFields(rendered_fields=expected_rendered_fields),
- log=mock.ANY,
- )
+ run(ti, log=mock.MagicMock())
+ expected_calls = [
+ mock.call.send_request(
+
msg=SetRenderedFields(rendered_fields=expected_rendered_fields),
+ log=mock.ANY,
+ ),
+ mock.call.send_request(
+ msg=TaskState(end_date=instant, state=TerminalTIState.SUCCESS),
+ log=mock.ANY,
+ ),
+ ]
Review Comment:
One to set the RTIF, followed by one to mark the task as success
--
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]