Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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 @@ -93,7 +93,8 @@
* This {@code classpath} configuration is only supported on YARN versions >= 2.9.0.
*/
public class YarnShuffleService extends AuxiliaryService {
private static final Logger logger = LoggerFactory.getLogger(YarnShuffleService.class);
private static final Logger defaultLogger = LoggerFactory.getLogger(YarnShuffleService.class);
private Logger logger = defaultLogger;

// Port on which the shuffle server listens for fetch requests
private static final String SPARK_SHUFFLE_SERVICE_PORT_KEY = "spark.shuffle.service.port";
Expand All @@ -107,6 +108,12 @@ public class YarnShuffleService extends AuxiliaryService {
"spark.yarn.shuffle.service.metrics.namespace";
private static final String DEFAULT_SPARK_SHUFFLE_SERVICE_METRICS_NAME = "sparkShuffleService";

/**
* The namespace to use for the logs produced by the shuffle service
*/
static final String SPARK_SHUFFLE_SERVICE_LOGS_NAMESPACE_KEY =
"spark.yarn.shuffle.service.logs.namespace";

// Whether the shuffle server should authenticate fetch requests
private static final String SPARK_AUTHENTICATE_KEY = "spark.authenticate";
private static final boolean DEFAULT_SPARK_AUTHENTICATE = false;
Expand Down Expand Up @@ -204,6 +211,13 @@ protected void serviceInit(Configuration externalConf) throws Exception {
confOverlayUrl);
_conf.addResource(confOverlayUrl);
}

String logsNamespace = _conf.get(SPARK_SHUFFLE_SERVICE_LOGS_NAMESPACE_KEY, "");
if (!logsNamespace.isEmpty()) {
String className = YarnShuffleService.class.getName();
logger = LoggerFactory.getLogger(className + "." + logsNamespace);
}

super.serviceInit(_conf);

boolean stopOnFailure = _conf.getBoolean(STOP_ON_FAILURE_KEY, DEFAULT_STOP_ON_FAILURE);
Expand Down Expand Up @@ -284,7 +298,7 @@ static MergedShuffleFileManager newMergedShuffleFileManagerInstance(TransportCon
// will also need the transport configuration.
return mergeManagerSubClazz.getConstructor(TransportConf.class).newInstance(conf);
} catch (Exception e) {
logger.error("Unable to create an instance of {}", mergeManagerImplClassName);
defaultLogger.error("Unable to create an instance of {}", mergeManagerImplClassName);
return new NoOpMergedShuffleFileManager(conf);
}
}
Expand Down
11 changes: 11 additions & 0 deletions docs/running-on-yarn.md
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,17 @@ The following extra configuration options are available when the shuffle service
NodeManager.
</td>
</tr>
<tr>
<td><code>spark.yarn.shuffle.service.logs.namespace</code></td>
<td><code>(not set)</code></td>
<td>
A namespace which will be appended to the class name when forming the logger name to use for
emitting logs from the YARN shuffle service, like
<code>org.apache.spark.network.yarn.YarnShuffleService.logsNamespaceValue</code>. Since some logging frameworks
may expect the logger name to look like a class name, it's generally recommended to provide a value which
would be a valid Java package or class name and not include spaces.
</td>
</tr>
</table>

Please note that the instructions above assume that the default shuffle service name,
Expand Down