Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/7839#discussion_r36252740
--- Diff:
network/yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
---
@@ -181,4 +249,38 @@ public ByteBuffer getMetaData() {
return ByteBuffer.allocate(0);
}
+ private Map<String, List<Entry<AppExecId, ExecutorShuffleInfo>>>
reloadRegisteredExecutors()
+ throws IOException, ClassNotFoundException {
+ if (registeredExecutorFile != null && registeredExecutorFile.exists())
{
+ logger.info("Reloading executors from {}", registeredExecutorFile);
+ return reloadRegisteredExecutors(registeredExecutorFile);
+ } else {
+ logger.info("No executor info to reload");
+ return new HashMap<>();
+ }
+ }
+
+
+ @VisibleForTesting
+ static Map<String, List<Entry<AppExecId, ExecutorShuffleInfo>>>
reloadRegisteredExecutors(
+ File file
+ ) throws IOException, ClassNotFoundException {
+ Map<String, List<Entry<AppExecId, ExecutorShuffleInfo>>> result = new
HashMap<>();
+ ObjectInputStream in = new ObjectInputStream(new
FileInputStream(file));
+ Map<AppExecId, ExecutorShuffleInfo> registeredExecutors =
+ (Map<AppExecId, ExecutorShuffleInfo>) in.readObject();
+ for (Entry<AppExecId, ExecutorShuffleInfo> e:
registeredExecutors.entrySet()) {
+ List<Map.Entry<AppExecId, ExecutorShuffleInfo>> executorsForApp =
+ result.get(e.getKey().appId);
+ if (executorsForApp == null) {
+ executorsForApp = new ArrayList<>();
+ result.put(e.getKey().appId, executorsForApp);
+ }
+ executorsForApp.add(new
AbstractMap.SimpleImmutableEntry<>(e.getKey(), e.getValue()));
+ }
+ in.close();
--- End diff --
This needs to be in a `finally` block.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]