Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MINOR] improvement(spark-client): put sparkConf as extra properties while client request accessCluster #2254

Merged
merged 7 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.spark.shuffle;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import scala.Tuple2;
Expand Down Expand Up @@ -512,4 +514,15 @@ public static RssConf toRssConf(SparkConf sparkConf) {
}
return rssConf;
}

public static Map<String, String> sparkConfToMap(SparkConf sparkConf) {
Map<String, String> map = new HashMap<>();

for (Tuple2<String, String> tuple : sparkConf.getAll()) {
String key = tuple._1;
map.put(key, tuple._2);
}

return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;

import scala.Tuple2;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
Expand Down Expand Up @@ -1064,7 +1062,7 @@ protected void registerShuffleServers(
}
LOG.info("Start to register shuffleId {}", shuffleId);
long start = System.currentTimeMillis();
Map<String, String> sparkConfMap = sparkConfToMap(getSparkConf());
Map<String, String> sparkConfMap = RssSparkConfig.sparkConfToMap(getSparkConf());
serverToPartitionRanges.entrySet().stream()
.forEach(
entry -> {
Expand Down Expand Up @@ -1095,7 +1093,7 @@ protected void registerShuffleServers(
}
LOG.info("Start to register shuffleId[{}]", shuffleId);
long start = System.currentTimeMillis();
Map<String, String> sparkConfMap = sparkConfToMap(getSparkConf());
Map<String, String> sparkConfMap = RssSparkConfig.sparkConfToMap(getSparkConf());
Set<Map.Entry<ShuffleServerInfo, List<PartitionRange>>> entries =
serverToPartitionRanges.entrySet();
entries.stream()
Expand Down Expand Up @@ -1141,15 +1139,4 @@ public boolean isRssStageRetryForFetchFailureEnabled() {
public SparkConf getSparkConf() {
return sparkConf;
}

public Map<String, String> sparkConfToMap(SparkConf sparkConf) {
Map<String, String> map = new HashMap<>();

for (Tuple2<String, String> tuple : sparkConf.getAll()) {
String key = tuple._1;
map.put(key, tuple._2);
}

return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ private boolean tryAccessCluster() {
Map<String, String> extraProperties = Maps.newHashMap();
extraProperties.put(
ACCESS_INFO_REQUIRED_SHUFFLE_NODES_NUM, String.valueOf(assignmentShuffleNodesNum));
extraProperties.putAll(RssSparkConfig.sparkConfToMap(sparkConf));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't put Spark configurations to coordinator. Coordinator isn't related to compute framework. The spark configurations is coupled with Spark framework. You can have an extractor instead of passing them directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is related to #2255 , I want to determine whether to ban an app by a specific ban id which extract from one of the spark client config, but I don't want client config it concretely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether it is good design to have a ban id list. It seems that it isn't common enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not common if bannedIdProvider contains spark.


Set<String> assignmentTags = RssSparkShuffleUtils.getAssignmentTags(sparkConf);
try {
Expand Down
Loading