zentol commented on a change in pull request #11887:
URL: https://github.com/apache/flink/pull/11887#discussion_r415734221
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/FileType.java
##########
@@ -22,6 +22,13 @@
* Different file types to request from the {@link TaskExecutor}.
*/
public enum FileType {
+ /**
+ * the log file type for taskmanager
Review comment:
this seems unrelated?
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
##########
@@ -1012,10 +1016,34 @@ public void disconnectResourceManager(Exception cause) {
}
}
+ @Override
+ public CompletableFuture<ThreadDumpInfo> requestThreadDump(Time
timeout) {
+ final Collection<ThreadInfo> threadDump =
JvmUtils.createThreadDump();
+
+ final Collection<ThreadDumpInfo.ThreadInfo> threadInfos =
threadDump.stream()
+ .map(threadInfo ->
ThreadDumpInfo.ThreadInfo.create(threadInfo.getThreadName(),
threadInfo.toString()))
Review comment:
I'm wondering whether this conversion should really be done on the
TaskExecutor.
I'd prefer if conversions to REST responses are done by the handler just to
separate things a bit.
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
##########
@@ -1012,10 +1016,34 @@ public void disconnectResourceManager(Exception cause) {
}
}
+ @Override
+ public CompletableFuture<ThreadDumpInfo> requestThreadDump(Time
timeout) {
+ final Collection<ThreadInfo> threadDump =
JvmUtils.createThreadDump();
+
+ final Collection<ThreadDumpInfo.ThreadInfo> threadInfos =
threadDump.stream()
+ .map(threadInfo ->
ThreadDumpInfo.ThreadInfo.create(threadInfo.getThreadName(),
threadInfo.toString()))
+ .collect(Collectors.toList());
+
+ return
CompletableFuture.completedFuture(ThreadDumpInfo.create(threadInfos));
+ }
+
//
======================================================================
// Internal methods
//
======================================================================
+ private CompletableFuture<TransientBlobKey>
putTransientBlobStream(InputStream inputStream, String fileTag) {
+ final TransientBlobCache transientBlobService =
blobCacheService.getTransientBlobService();
+ final TransientBlobKey transientBlobKey;
+
+ try {
+ transientBlobKey =
transientBlobService.putTransient(inputStream);
+ } catch (IOException e) {
+ log.debug("Could not upload file {}.", fileTag, e);
+ return FutureUtils.completedExceptionally(new
FlinkException("Could not upload file " + fileTag + '.', e));
+ }
+ return CompletableFuture.completedFuture(transientBlobKey);
+ }
+
Review comment:
They still belong into a separate commit though.
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/taskmanager/ThreadDumpInfo.java
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.rest.messages.taskmanager;
+
+import org.apache.flink.runtime.rest.messages.ResponseBody;
+
+import
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Objects;
+
+/**
+ * Class containing thread dump information.
+ */
+public class ThreadDumpInfo implements ResponseBody, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final String FIELD_NAME_THREAD_INFOS = "threadInfos";
+
+ @JsonProperty(FIELD_NAME_THREAD_INFOS)
+ private final Collection<ThreadInfo> threadInfos;
Review comment:
Why not a map thread_name -> thread_info? I think this would be more
generally usable.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]