Shortening API
This commit is contained in:
parent
05285f226a
commit
93297f8c1a
3 changed files with 18 additions and 16 deletions
22
README.md
22
README.md
|
@ -70,16 +70,16 @@ defer r.Close()
|
|||
|
||||
Construct a job using an AuroraJob struct.
|
||||
```
|
||||
job = realis.NewJob().SetEnvironment("prod").
|
||||
SetRole("vagrant").
|
||||
SetName("hello_world_from_gorealis").
|
||||
SetExecutorName("docker-compose-executor").
|
||||
SetExecutorData("{}").
|
||||
SetNumCpus(1).
|
||||
SetRam(64).
|
||||
job = realis.NewJob().Environment("prod").
|
||||
Role("vagrant").
|
||||
Name("hello_world_from_gorealis").
|
||||
ExecutorName("docker-compose-executor").
|
||||
ExecutorData("{}").
|
||||
NumCpus(1).
|
||||
Ram(64).
|
||||
SetDisk(100).
|
||||
SetIsService(false).
|
||||
SetInstanceCount(1).
|
||||
IsService(false).
|
||||
InstanceCount(1).
|
||||
AddPorts(1).
|
||||
AddLabel("fileName", "sample-app/sample-app.yml").
|
||||
AddURI("https://dl.bintray.com/rdelvalle/mesos-compose-executor/sample-app.tar.gz", true, true)
|
||||
|
@ -109,8 +109,8 @@ r.AddInstances(job.GetKey(), 5)
|
|||
Updating the job configuration of a service job:
|
||||
```
|
||||
updateJob := realis.NewUpdateJob(job)
|
||||
updateJob.SetInstanceCount(1)
|
||||
updateJob.SetRam(128)
|
||||
updateJob.InstanceCount(1)
|
||||
updateJob.Ram(128)
|
||||
|
||||
msg, err := r.UpdateJob(updateJob, "")
|
||||
```
|
||||
|
|
|
@ -52,12 +52,13 @@ func main() {
|
|||
fmt.Print("Error reading json config file: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
job = realis.NewJob().Environment("prod").
|
||||
job = realis.NewJob().
|
||||
Environment("prod").
|
||||
Role("vagrant").
|
||||
Name("hello_world_from_gorealis").
|
||||
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
|
||||
ExecutorData(string(payload)).
|
||||
NumCpus(1).
|
||||
CPU(1).
|
||||
Ram(64).
|
||||
Disk(100).
|
||||
IsService(true).
|
||||
|
@ -65,12 +66,13 @@ func main() {
|
|||
AddPorts(1)
|
||||
break
|
||||
case "compose":
|
||||
job = realis.NewJob().Environment("prod").
|
||||
job = realis.NewJob().
|
||||
Environment("prod").
|
||||
Role("vagrant").
|
||||
Name("docker-compose").
|
||||
ExecutorName("docker-compose-executor").
|
||||
ExecutorData("{}").
|
||||
NumCpus(1).
|
||||
CPU(1).
|
||||
Ram(64).
|
||||
Disk(100).
|
||||
IsService(false).
|
||||
|
|
2
job.go
2
job.go
|
@ -96,7 +96,7 @@ func (a *Job) ExecutorData(data string) *Job {
|
|||
return a
|
||||
}
|
||||
|
||||
func (a *Job) NumCpus(cpus float64) *Job {
|
||||
func (a *Job) CPU(cpus float64) *Job {
|
||||
a.numCpus.NumCpus = &cpus
|
||||
a.jobConfig.TaskConfig.NumCpus = cpus //Will be deprecated soon
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue