You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dstandish (via GitHub)" <gi...@apache.org> on 2025/07/17 20:52:31 UTC

[PR] Use asyncio.run instead of loop.run_until_complete. [airflow]

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

   This doesn't depend on loop being there, which is a functionality that is deprecated.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use asyncio.run instead of loop.run_until_complete. [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on code in PR #53475:
URL: https://github.com/apache/airflow/pull/53475#discussion_r2219976785


##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -380,9 +381,8 @@ def create_pod(self, pod: V1Pod) -> V1Pod:
 
     async def watch_pod_events(self, pod: V1Pod, check_interval: int = 1) -> None:
         """Read pod events and writes into log."""
-        self.keep_watching_for_events = True
         num_events = 0
-        while self.keep_watching_for_events:
+        while not self.stop_watching_events:
             events = self.read_pod_events(pod)

Review Comment:
   @jedcunningham you might find this interesting. 
   
   there was actually a race condition here.
   
   i found in the system tests that if await_pod_start ran first, then watch_pod_events would _set keep_watching_for_events back to true_ and nothing would ever set it false.
   
   so these subtle changes ensure that once it is set to stop, it will stay that way.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use asyncio.run instead of loop.run_until_complete. [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on PR #53475:
URL: https://github.com/apache/airflow/pull/53475#issuecomment-3104609743

   Ok -- green except for two unrelated flakey tests.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use asyncio.run instead of loop.run_until_complete. [airflow]

Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on PR #53475:
URL: https://github.com/apache/airflow/pull/53475#issuecomment-3173407692

   @ashb this shouldn't be set for 3.0.4 milestone right? It is a provider only change.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use asyncio.run instead of loop.run_until_complete. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #53475:
URL: https://github.com/apache/airflow/pull/53475#issuecomment-3174031909

   Good point


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use asyncio.run instead of loop.run_until_complete. [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #53475:
URL: https://github.com/apache/airflow/pull/53475#discussion_r2222518180


##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -380,9 +381,8 @@ def create_pod(self, pod: V1Pod) -> V1Pod:
 
     async def watch_pod_events(self, pod: V1Pod, check_interval: int = 1) -> None:
         """Read pod events and writes into log."""
-        self.keep_watching_for_events = True
         num_events = 0
-        while self.keep_watching_for_events:
+        while not self.stop_watching_events:
             events = self.read_pod_events(pod)

Review Comment:
   `not stop` -- do we need to change this do a double negative?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use asyncio.run instead of loop.run_until_complete. [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish commented on code in PR #53475:
URL: https://github.com/apache/airflow/pull/53475#discussion_r2223683095


##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -380,9 +381,8 @@ def create_pod(self, pod: V1Pod) -> V1Pod:
 
     async def watch_pod_events(self, pod: V1Pod, check_interval: int = 1) -> None:
         """Read pod events and writes into log."""
-        self.keep_watching_for_events = True
         num_events = 0
-        while self.keep_watching_for_events:
+        while not self.stop_watching_events:
             events = self.read_pod_events(pod)

Review Comment:
   i don't think there's anything wrong with `while not stop`
   
   see also https://github.com/apache/airflow/blob/016b7cdb2995c62f4849a26acd6c15b6d8a6be95/airflow-core/src/airflow/jobs/triggerer_job_runner.py#L833



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use asyncio.run instead of loop.run_until_complete. [airflow]

Posted by "dstandish (via GitHub)" <gi...@apache.org>.
dstandish merged PR #53475:
URL: https://github.com/apache/airflow/pull/53475


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org