Skip to content

Commit

Permalink
Merge pull request #603 from drexin/wip-drexin-add-uris-to-executor
Browse files Browse the repository at this point in the history
Add uris to the CommandInfo when a custom executor is set
  • Loading branch information
gkleiman committed Dec 16, 2015
2 parents c9a23ae + 6b43358 commit 6e7a495
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,14 @@ class MesosTaskBuilder @Inject()(val conf: SchedulerConfiguration) {
)
}

val uriProtos = job.uris.map { uri =>
CommandInfo.URI.newBuilder()
.setValue(uri)
.build()
}

if (job.executor.nonEmpty) {
appendExecutorData(taskInfo, job)
appendExecutorData(taskInfo, job, environment, uriProtos)
} else {
val command = CommandInfo.newBuilder()
if (job.command.startsWith("http") || job.command.startsWith("ftp")) {
Expand All @@ -96,11 +102,6 @@ class MesosTaskBuilder @Inject()(val conf: SchedulerConfiguration) {
.setValue("\"." + job.command.substring(job.command.lastIndexOf("/")) + "\"")
.setEnvironment(environment)
} else {
val uriProtos = job.uris.map(uri => {
CommandInfo.URI.newBuilder()
.setValue(uri)
.build()
})
command.setValue(job.command)
.setShell(job.shell)
.setEnvironment(environment)
Expand Down Expand Up @@ -174,10 +175,12 @@ class MesosTaskBuilder @Inject()(val conf: SchedulerConfiguration) {
.build()).build
}

def appendExecutorData(taskInfo: TaskInfo.Builder, job: BaseJob) {
def appendExecutorData(taskInfo: TaskInfo.Builder, job: BaseJob, environment: Environment.Builder, uriProtos: Seq[CommandInfo.URI]) {
log.info("Appending executor:" + job.executor + ", flags:" + job.executorFlags + ", command:" + job.command)
val command = CommandInfo.newBuilder()
.setValue(job.executor)
.setEnvironment(environment)
.addAllUris(uriProtos.asJava)
if (job.runAsUser.nonEmpty) {
command.setUser(job.runAsUser)
}
Expand Down

0 comments on commit 6e7a495

Please sign in to comment.