diff --git a/examples/client.go b/examples/client.go index e5651c3..ae5fea8 100644 --- a/examples/client.go +++ b/examples/client.go @@ -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) } diff --git a/job.go b/job.go index b9d220d..1996b3e 100644 --- a/job.go +++ b/job.go @@ -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 }