Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/8872#discussion_r53530824
--- Diff:
core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosClusterScheduler.scala
---
@@ -496,28 +504,29 @@ private[spark] class MesosClusterScheduler(
container, image, volumes = volumes, portmaps = portmaps)
taskInfo.setContainer(container.build())
}
- val queuedTasks = tasks.getOrElseUpdate(offer.offer.getId, new
ArrayBuffer[TaskInfo])
+ val queuedTasks = tasks.getOrElseUpdate(offer.offerId, new
ArrayBuffer[TaskInfo])
queuedTasks += taskInfo.build()
- logTrace(s"Using offer ${offer.offer.getId.getValue} to launch
driver " +
+ logTrace(s"Using offer ${offer.offerId.getValue} to launch driver
" +
submission.submissionId)
- val newState = new MesosClusterSubmissionState(submission, taskId,
offer.offer.getSlaveId,
+ val newState = new MesosClusterSubmissionState(submission, taskId,
offer.slaveId,
None, new Date(), None)
launchedDrivers(submission.submissionId) = newState
launchedDriversState.persist(submission.submissionId, newState)
afterLaunchCallback(submission.submissionId)
}
}
+ currentOffers
}
override def resourceOffers(driver: SchedulerDriver, offers:
JList[Offer]): Unit = {
- val currentOffers = offers.asScala.map(o =>
- new ResourceOffer(
- o, getResource(o.getResourcesList, "cpus"),
getResource(o.getResourcesList, "mem"))
- ).toList
- logTrace(s"Received offers from Mesos:
\n${currentOffers.mkString("\n")}")
+ logTrace(s"Received offers from Mesos:
\n${offers.asScala.mkString("\n")}")
val tasks = new mutable.HashMap[OfferID, ArrayBuffer[TaskInfo]]()
val currentTime = new Date()
+ val currentOffers = offers.asScala.map {
+ o => new ResourceOffer(o.getId, o.getSlaveId, o.getResourcesList)
+ }.toList.asJava
--- End diff --
I looked for the places where this is used. All you're doing is passing
this java list into `scheduleTasks`, where you internally converts it back to
scala again, and using it at the end of this method to decline offers, where
you convert it back to scala anyway. You really don't need to make this
`asJava` again.
---
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]