FrankYang0529 commented on code in PR #75538:
URL: https://github.com/apache/airflow/pull/75538#discussion_r4490671421
##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/Server.kt:
##########
@@ -235,8 +236,17 @@ class CoordinatorServer(
startup: StartupDetails,
coordinator: CoordinatorComm,
) {
- val result = runTask(bundle, startup, coordinator)
- coordinator.communicate<Unit>(result)
+ // For a StoppableTask, the signal trap stays open until the SDK reports
the task's result. If the
+ // first signal arrives during the report, it therefore cannot stop the
JVM before the result is sent.
+ Cancellation().use { cancellation ->
+ val result = runTask(bundle, startup, coordinator, cancellation)
+ cancellation.finish()
+ // The task or its onKill can leave this thread interrupted. runBlocking
in serve would then throw
+ // InterruptedException, and the JVM would exit with code 1 before the
supervisor acknowledges the
+ // task's result.
+ Thread.interrupted()
Review Comment:
Added an info level log.
--
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]