This is an automated email from the ASF dual-hosted git repository.
pnowojski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 2c16d2b3d2d [hotfix] Log Job ID when task is failed externally
2c16d2b3d2d is described below
commit 2c16d2b3d2dbc9419cd4530949fa54d50645ee0a
Author: Roman Khachatryan <[email protected]>
AuthorDate: Fri Apr 5 13:37:58 2024 +0200
[hotfix] Log Job ID when task is failed externally
---
.../java/org/apache/flink/runtime/taskmanager/Task.java | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git
a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
index f23ec1f3a3b..e813de5c398 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
@@ -1144,8 +1144,10 @@ public class Task
* <p>This method never blocks.
*/
public void cancelExecution() {
- LOG.info("Attempting to cancel task {} ({}).", taskNameWithSubtask,
executionId);
- cancelOrFailAndCancelInvokable(ExecutionState.CANCELING, null);
+ try (MdcUtils.MdcCloseable ignored =
MdcUtils.withContext(MdcUtils.asContextData(jobId))) {
+ LOG.info("Attempting to cancel task {} ({}).",
taskNameWithSubtask, executionId);
+ cancelOrFailAndCancelInvokable(ExecutionState.CANCELING, null);
+ }
}
/**
@@ -1159,8 +1161,13 @@ public class Task
*/
@Override
public void failExternally(Throwable cause) {
- LOG.info("Attempting to fail task externally {} ({}).",
taskNameWithSubtask, executionId);
- cancelOrFailAndCancelInvokable(ExecutionState.FAILED, cause);
+ try (MdcUtils.MdcCloseable ignored =
MdcUtils.withContext(MdcUtils.asContextData(jobId))) {
+ LOG.info(
+ "Attempting to fail task externally {} ({}).",
+ taskNameWithSubtask,
+ executionId);
+ cancelOrFailAndCancelInvokable(ExecutionState.FAILED, cause);
+ }
}
private void cancelOrFailAndCancelInvokable(ExecutionState targetState,
Throwable cause) {