Skip to content

Conversation

@jroachgolf84
Copy link
Collaborator

1e79418 removed the event parameter from the execute_complete method in the TimeSensor Sensor. This resulted in the exception shown below when the TimeSensor returned.

To test/validate the changes made, the code provided in the issue was tested and executed successfully. The unit tests for this provider were also successfully executed.

TypeError: TimeSensor.execute_complete() got an unexpected keyword argument 'event'
File "/usr/local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py", line 877 in run

File "/usr/local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py", line 1164 in _execute_task

File "/usr/local/lib/python3.12/site-packages/airflow/sdk/bases/sensor.py", line 255 in resume_execution

File "/usr/local/lib/python3.12/site-packages/airflow/sdk/bases/operator.py", line 1609 in resume_execution

closed: #53591

@nrnavaneet
Copy link
Contributor

nrnavaneet commented Jul 23, 2025

Well, I'm not a maintainer, but LGTM. Maybe consider adding a test in
providers/standard/tests/unit/standard/sensors/test_time.py if the maintainers think it's needed :

    def test_execute_complete_accepts_event_argument(self):
        """Ensure execute_complete supports the 'event' kwarg when deferrable=True."""
        with DAG(
            dag_id="test_execute_complete_event",
            schedule=None,
            start_date=datetime(2020, 1, 1),
        ):
            op = TimeSensor(task_id="test", target_time=time(10, 0), deferrable=True)

        try:
            op.execute_complete(context={}, event={"status": "success"})
        except TypeError as e:
            pytest.fail(f"execute_complete raised TypeError unexpectedly: {e}")

What do u think ? @jroachgolf84

@jroachgolf84
Copy link
Collaborator Author

I agree, thanks for the feedback. I've added that test now!

@nrnavaneet
Copy link
Contributor

Glad :) Let's see what the maintainers think @potiuk

@jroachgolf84 jroachgolf84 requested a review from sunank200 July 24, 2025 12:29
@jroachgolf84
Copy link
Collaborator Author

@sunank200, do you mind taking a look at this?

@jroachgolf84
Copy link
Collaborator Author

jroachgolf84 commented Jul 31, 2025

@amoghrajesh, @rawwar, could you take a look at this?

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
@jroachgolf84
Copy link
Collaborator Author

@RNHTTR, can you take a look at this PR?

@amoghrajesh amoghrajesh merged commit f91d192 into apache:main Aug 6, 2025
103 checks passed
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error with TimeSensor and deferrable=True

5 participants