Submission of docker containers without an executor (aka running container as a task) is now supported

This commit is contained in:
Renan DelValle 2016-11-02 15:24:06 -04:00
parent 66a2868aab
commit 76b404e087
2 changed files with 24 additions and 3 deletions

View file

@ -82,7 +82,7 @@ func main() {
job = realis.NewJob().
Environment("prod").
Role("vagrant").
Name("hello_world_from_gorealis_docker").
Name("hello_world_from_gorealis").
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
ExecutorData(string(payload)).
CPU(1).
@ -108,8 +108,20 @@ func main() {
AddLabel("fileName", "sample-app/docker-compose.yml").
AddURIs(true, true, "https://github.com/mesos/docker-compose-executor/releases/download/0.1.0/sample-app.tar.gz")
break
case "none":
job = realis.NewJob().
Environment("prod").
Role("vagrant").
Name("docker_as_task").
CPU(1).
RAM(64).
Disk(100).
IsService(true).
InstanceCount(1).
AddPorts(1)
break
default:
fmt.Println("Only thermos and compose are supported for now")
fmt.Println("Only thermos, compose, and none are supported for now")
os.Exit(1)
}

11
job.go
View file

@ -68,7 +68,6 @@ func NewJob() Job {
taskConfig.Job = jobKey
taskConfig.Container = aurora.NewContainer()
taskConfig.Container.Mesos = aurora.NewMesosContainer()
taskConfig.ExecutorConfig = aurora.NewExecutorConfig()
taskConfig.MesosFetcherUris = make(map[*aurora.MesosFetcherURI]bool)
taskConfig.Metadata = make(map[*aurora.Metadata]bool)
taskConfig.Constraints = make(map[*aurora.Constraint]bool)
@ -116,12 +115,22 @@ func (j AuroraJob) Name(name string) Job {
// Set name of the executor that will the task will be configured to.
func (j AuroraJob) ExecutorName(name string) Job {
if j.jobConfig.TaskConfig.ExecutorConfig == nil {
j.jobConfig.TaskConfig.ExecutorConfig = aurora.NewExecutorConfig()
}
j.jobConfig.TaskConfig.ExecutorConfig.Name = name
return j
}
// Will be included as part of entire task inside the scheduler that will be serialized.
func (j AuroraJob) ExecutorData(data string) Job {
if j.jobConfig.TaskConfig.ExecutorConfig == nil {
j.jobConfig.TaskConfig.ExecutorConfig = aurora.NewExecutorConfig()
}
j.jobConfig.TaskConfig.ExecutorConfig.Data = data
return j
}