bugfix: monitor variables were dependent on order in which commands were initialized inside on init(). Using PreRun we can control the value per command called by having the function run only when the function is executed.
This commit is contained in:
parent
fee20090d0
commit
d1097f33ac
3 changed files with 40 additions and 16 deletions
|
@ -21,4 +21,3 @@ var docsCmd = &cobra.Command{
|
|||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ var count int64
|
|||
var filename string
|
||||
var message = new(string)
|
||||
var updateID string
|
||||
var statusList = make([]string, 0, 0)
|
||||
var log = logrus.New()
|
||||
|
||||
const australisVer = "v0.0.8"
|
||||
|
|
24
cmd/start.go
24
cmd/start.go
|
@ -58,6 +58,12 @@ are not allowed to schedule new tasks and any tasks already running on this Agen
|
|||
are killed and rescheduled in an Agent that is not in maintenance mode. Command
|
||||
expects a space separated list of hosts to place into maintenance mode.`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
// Manually initializing default values for this command as the default value for shared variables will
|
||||
// be dependent on the order in which all commands were initialized
|
||||
monitorTimeout = time.Minute * 10
|
||||
monitorInterval = time.Second * 5
|
||||
},
|
||||
Run: drain,
|
||||
}
|
||||
|
||||
|
@ -76,6 +82,12 @@ var startSLACountDrainCmd = &cobra.Command{
|
|||
Long: `Adds a Mesos Agent to Aurora's Drain list. Tasks will be drained using the count SLA policy as a fallback
|
||||
when a Job does not have a defined SLA policy.`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
// Manually initializing default values for this command as the default value for shared variables will
|
||||
// be dependent on the order in which all commands were initialized
|
||||
monitorTimeout = time.Minute * 20
|
||||
monitorInterval = time.Second * 10
|
||||
},
|
||||
Run: SLACountDrain,
|
||||
}
|
||||
|
||||
|
@ -85,6 +97,12 @@ var startSLAPercentageDrainCmd = &cobra.Command{
|
|||
Long: `Adds a Mesos Agent to Aurora's Drain list. Tasks will be drained using the percentage SLA policy as a fallback
|
||||
when a Job does not have a defined SLA policy.`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
// Manually initializing default values for this command as the default value for shared variables will
|
||||
// be dependent on the order in which all commands were initialized
|
||||
monitorTimeout = time.Minute * 20
|
||||
monitorInterval = time.Second * 10
|
||||
},
|
||||
Run: SLAPercentageDrain,
|
||||
}
|
||||
|
||||
|
@ -95,6 +113,12 @@ var startMaintenanceCmd = &cobra.Command{
|
|||
are de-prioritized for scheduling a task. Command
|
||||
expects a space separated list of hosts to place into maintenance mode.`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
// Manually initializing default values for this command as the default value for shared variables will
|
||||
// be dependent on the order in which all commands were initialized
|
||||
monitorTimeout = time.Minute * 1
|
||||
monitorInterval = time.Second * 5
|
||||
},
|
||||
Run: maintenance,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue