Github user mridulm commented on a diff in the pull request:
https://github.com/apache/spark/pull/16810#discussion_r100470782
--- Diff:
resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala
---
@@ -253,53 +233,24 @@ private[spark] class Client(
sparkConf.get(AM_NODE_LABEL_EXPRESSION) match {
case Some(expr) =>
- try {
- val amRequest = Records.newRecord(classOf[ResourceRequest])
- amRequest.setResourceName(ResourceRequest.ANY)
- amRequest.setPriority(Priority.newInstance(0))
- amRequest.setCapability(capability)
- amRequest.setNumContainers(1)
- val method =
amRequest.getClass.getMethod("setNodeLabelExpression", classOf[String])
- method.invoke(amRequest, expr)
-
- val setResourceRequestMethod =
- appContext.getClass.getMethod("setAMContainerResourceRequest",
classOf[ResourceRequest])
- setResourceRequestMethod.invoke(appContext, amRequest)
- } catch {
- case e: NoSuchMethodException =>
- logWarning(s"Ignoring ${AM_NODE_LABEL_EXPRESSION.key} because
the version " +
- "of YARN does not support it")
- appContext.setResource(capability)
- }
+ val amRequest = Records.newRecord(classOf[ResourceRequest])
+ amRequest.setResourceName(ResourceRequest.ANY)
+ amRequest.setPriority(Priority.newInstance(0))
+ amRequest.setCapability(capability)
+ amRequest.setNumContainers(1)
+ amRequest.setNodeLabelExpression(expr)
+ appContext.setAMContainerResourceRequest(amRequest)
case None =>
appContext.setResource(capability)
}
sparkConf.get(ROLLED_LOG_INCLUDE_PATTERN).foreach { includePattern =>
- try {
- val logAggregationContext = Records.newRecord(
-
Utils.classForName("org.apache.hadoop.yarn.api.records.LogAggregationContext"))
- .asInstanceOf[Object]
-
- val setRolledLogsIncludePatternMethod =
-
logAggregationContext.getClass.getMethod("setRolledLogsIncludePattern",
classOf[String])
- setRolledLogsIncludePatternMethod.invoke(logAggregationContext,
includePattern)
-
- sparkConf.get(ROLLED_LOG_EXCLUDE_PATTERN).foreach { excludePattern
=>
- val setRolledLogsExcludePatternMethod =
-
logAggregationContext.getClass.getMethod("setRolledLogsExcludePattern",
classOf[String])
- setRolledLogsExcludePatternMethod.invoke(logAggregationContext,
excludePattern)
- }
-
- val setLogAggregationContextMethod =
- appContext.getClass.getMethod("setLogAggregationContext",
-
Utils.classForName("org.apache.hadoop.yarn.api.records.LogAggregationContext"))
- setLogAggregationContextMethod.invoke(appContext,
logAggregationContext)
- } catch {
- case NonFatal(e) =>
- logWarning(s"Ignoring ${ROLLED_LOG_INCLUDE_PATTERN.key} because
the version of YARN " +
- s"does not support it", e)
+ val logAggregationContext =
Records.newRecord(classOf[LogAggregationContext])
+ logAggregationContext.setRolledLogsIncludePattern(includePattern)
+ sparkConf.get(ROLLED_LOG_EXCLUDE_PATTERN).foreach { excludePattern =>
+ logAggregationContext.setRolledLogsExcludePattern(excludePattern)
--- End diff --
This is not in 2.6 - but introduced in a minor release in 2.6.4 [1]
Since our default is 2.6.5, the issue is masked - but anything older than
2.6.4 causes compilation failure.
[1]
https://hadoop.apache.org/docs/r2.6.3/api/org/apache/hadoop/yarn/api/records/LogAggregationContext.html
vs
https://hadoop.apache.org/docs/r2.6.4/api/org/apache/hadoop/yarn/api/records/LogAggregationContext.html
---
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]