Compare commits

...

9 commits
v1.0.4 ... main

Author SHA1 Message Date
lawwong1
464db4e5cc
Implement Australis api to restart a task (#43) 2022-09-22 20:05:19 -07:00
ananaysingh
589e337e28
Updated kill.go (#42)
in killTask function, null check removed for instances, as it is a mandatory parameter in the killTask command. Also made changes to improve language consistency
2022-09-15 10:37:02 -07:00
lawwong1
7b298f7a35
Generate Docs for Australis (#41)
Co-authored-by: Lawrence Wong <lawwong@paypal.com>
2022-09-09 09:07:39 -07:00
nhatle
8ed6f5a773 release 1.0.5 2022-08-31 15:05:08 -07:00
nhatle
b08640f26a fix duplicated flags -i 2022-08-31 15:04:55 -07:00
nhatle
3d49194ccd release 1.0.5 2022-08-31 13:44:08 -07:00
lawwong1
a19c7e1fb5
API to get master nodes for mesos and aurora (#38) 2022-08-24 10:25:49 -07:00
ananaysingh
b0743636a1
KillTask API (#37) 2022-08-18 10:27:57 -07:00
lawwong1
2c703978bb
given a task status, list all tasks that have that status in the cluster (#35) 2022-08-15 13:35:04 -07:00
55 changed files with 865 additions and 43 deletions

View file

@ -1,4 +1,9 @@
1.0.5 (unreleased)
1.0.6 (unreleased)
1.0.5
* fetch mesos & aurora master nodes
* kill an instance from a job
1.0.4

View file

@ -97,6 +97,38 @@ func init() {
help(cmd, s)
})
/* Fetch Master nodes/Leader */
masterCmd.Flags().String("zkPath", "/aurora/scheduler", "Zookeeper node path to get master nodes/leader")
fetchCmd.AddCommand(masterCmd)
// Hijack help function to hide unnecessary global flags
masterCmd.SetHelpFunc(func(cmd *cobra.Command, s []string) {
if cmd.HasInheritedFlags() {
cmd.InheritedFlags().VisitAll(func(f *pflag.Flag) {
if f.Name != "logLevel" {
f.Hidden = true
}
})
}
help(cmd, s)
})
mesosMasterCmd.Flags().String("zkPath", "/mesos", "Zookeeper node path to get mesos master nodes/leader")
mesosCmd.AddCommand(mesosMasterCmd)
// Hijack help function to hide unnecessary global flags
mesosMasterCmd.SetHelpFunc(func(cmd *cobra.Command, s []string) {
if cmd.HasInheritedFlags() {
cmd.InheritedFlags().VisitAll(func(f *pflag.Flag) {
if f.Name != "logLevel" {
f.Hidden = true
}
})
}
help(cmd, s)
})
// Fetch jobs
fetchJobsCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
fetchCmd.AddCommand(fetchJobsCmd)
@ -121,6 +153,27 @@ func init() {
}
help(cmd, s)
})
// fetch tasks with status
fetchCmd.AddCommand(fetchTasksWithStatusCmd)
fetchTasksWithStatusCmd.Flags().StringVarP(taskStatus, "status", "x", "", "Task Status")
fetchTasksWithStatusCmd.MarkFlagRequired("status")
fetchTasksWithStatusCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
fetchTasksWithStatusCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
fetchTasksWithStatusCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
// Hijack help function to hide unnecessary global flags
fetchTasksWithStatusCmd.SetHelpFunc(func(cmd *cobra.Command, s []string) {
if cmd.HasInheritedFlags() {
cmd.InheritedFlags().VisitAll(func(f *pflag.Flag) {
if f.Name != "logLevel" {
f.Hidden = true
}
})
}
help(cmd, s)
})
}
var fetchCmd = &cobra.Command{
@ -159,6 +212,18 @@ Pass Zookeeper nodes separated by a space as an argument to this command.`,
Run: fetchLeader,
}
var masterCmd = &cobra.Command{
Use: "master [zkNode0 zkNode1 ...zkNodeN]",
PersistentPreRun: func(cmd *cobra.Command, args []string) {}, // We don't need a realis client for this cmd
PersistentPostRun: func(cmd *cobra.Command, args []string) {}, // We don't need a realis client for this cmd
PreRun: setConfig,
Args: cobra.MinimumNArgs(1),
Short: "Fetch current Aurora master nodes/leader given Zookeeper nodes. ",
Long: `Gets the current aurora master nodes/leader using information from Zookeeper path.
Pass Zookeeper nodes separated by a space as an argument to this command.`,
Run: fetchMaster,
}
var mesosCmd = &cobra.Command{
Use: "mesos",
PreRun: setConfig,
@ -177,6 +242,18 @@ it fetches leader from local Mesos agent or Zookeeper`,
Run: fetchMesosLeader,
}
var mesosMasterCmd = &cobra.Command{
Use: "master [zkNode0 zkNode1 ...zkNodeN]",
PersistentPreRun: func(cmd *cobra.Command, args []string) {}, // We don't need a realis client for this cmd
PersistentPostRun: func(cmd *cobra.Command, args []string) {}, // We don't need a realis client for this cmd
PreRun: setConfig,
Short: "Fetch current Mesos-master nodes/leader given Zookeeper nodes.",
Long: `Gets the current Mesos-master instances using information from Zookeeper path.
Pass Zookeeper nodes separated by a space as an argument to this command. If no nodes are provided,
it fetches Mesos-master nodes/leader from local Mesos agent or Zookeeper`,
Run: fetchMesosMaster,
}
var fetchJobsCmd = &cobra.Command{
Use: "jobs",
Short: "Fetch a list of task Aurora running under a role.",
@ -206,6 +283,13 @@ var fetchAvailCapacityCmd = &cobra.Command{
Run: fetchAvailCapacity,
}
var fetchTasksWithStatusCmd = &cobra.Command{
Use: "tasks",
Short: "Fetch tasks with status",
Long: `This command will return the list of tasks with a given status`,
Run: fetchTasksWithStatus,
}
func fetchTasksConfig(cmd *cobra.Command, args []string) {
log.Infof("Fetching job configuration for [%s/%s/%s] \n", *env, *role, *name)
@ -328,6 +412,58 @@ func fetchMesosLeader(cmd *cobra.Command, args []string) {
fmt.Println(url)
}
func fetchMaster(cmd *cobra.Command, args []string) {
log.Infof("Fetching master nodes from %v \n", args)
if len(args) < 1 {
log.Fatalln("At least one Zookeeper node address must be passed in.")
}
masterMap, err := realis.MasterNodesFromZKOpts(realis.ZKEndpoints(args...), realis.ZKPath(cmd.Flag("zkPath").Value.String()))
if err != nil {
log.Fatalf("error: %+v\n", err)
}
if toJson {
fmt.Println(internal.ToJSON(masterMap))
} else {
for key, masterNodes := range masterMap {
for _, masterNode := range masterNodes {
fmt.Println(key + "=" + masterNode)
}
}
}
}
func fetchMesosMaster(cmd *cobra.Command, args []string) {
if len(args) < 1 {
mesosAgentFlags, err := fetchMasterFromAgent(localAgentStateURL)
if err != nil || mesosAgentFlags.Master == "" {
log.Debugf("unable to fetch Mesos master nodes via local Mesos agent: %v", err)
args = append(args, "localhost")
} else {
args = append(args, strings.Split(mesosAgentFlags.Master, ",")...)
}
}
log.Infof("Fetching Mesos-master nodes from Zookeeper node(s): %v \n", args)
mesosMasterMap, err := realis.MesosMasterNodesFromZKOpts(realis.ZKEndpoints(args...), realis.ZKPath(cmd.Flag("zkPath").Value.String()))
if err != nil {
log.Fatalf("error: %+v\n", err)
}
if toJson {
fmt.Println(internal.ToJSON(mesosMasterMap))
} else {
for key, mesosMasterNodes := range mesosMasterMap {
for _, mesosMasterNode := range mesosMasterNodes {
fmt.Println(key + "=" + mesosMasterNode)
}
}
}
}
func fetchMasterFromAgent(url string) (mesosAgentFlags mesosAgentFlags, err error) {
resp, err := http.Get(url)
if err != nil {
@ -476,3 +612,74 @@ func fetchAvailCapacity(cmd *cobra.Command, args []string) {
fmt.Println(capacity)
}
}
//fetchTasksWithStatus returns lists of tasks for a given set of status
func fetchTasksWithStatus(cmd *cobra.Command, args []string) {
status := *taskStatus
log.Infof("Fetching tasks for role/environment/job:[%s/%s/%s] \n", *role, *env, *name)
log.Infof("Fetching tasks for a given status: %v \n", status)
// This Query takes nil for values it shouldn't need to match against.
// This allows us to potentially avoid expensive calls for specific environments, roles, or job names.
if *env == "" {
env = nil
}
if *role == "" {
role = nil
}
if *name == "" {
name = nil
}
// role needs to be specified if env is specified
if env != nil {
if role == nil {
log.Fatalln("Role must be specified when env is specified.")
}
}
// role or env needs to be specified if name is specified
if name != nil {
if role == nil && env == nil {
log.Fatalln("Role or env must be specified when name is specified.")
}
}
queryStatuses, err := scheduleStatusFromString(status)
if err != nil {
log.Fatalf("error: %+v", err)
}
taskQuery := &aurora.TaskQuery{Environment: env, Role: role, JobName: name, Statuses: queryStatuses}
tasks, err := client.GetTasksWithoutConfigs(taskQuery)
if err != nil {
log.Fatalf("error: %+v", err)
}
if toJson {
taskStatus := strings.ToUpper(status)
// convert task lists to a list of task id like role-env-name-[instance-id]
taskIdsMap := map[string][]string{}
var taskIds []string
for _, task := range tasks {
taskIds = append(taskIds, task.AssignedTask.TaskId)
}
taskIdsMap[taskStatus] = taskIds
fmt.Println(internal.ToJSON(taskIdsMap))
} else {
fmt.Printf("Tasks for status %s:\n", strings.ToUpper(status))
for _, t := range tasks {
fmt.Println(t.AssignedTask.TaskId)
}
}
}
// Convert status slice into ScheduleStatus slice
func scheduleStatusFromString(status string) ([]aurora.ScheduleStatus, error) {
scheduleStatus, err := aurora.ScheduleStatusFromString(strings.ToUpper(status))
if err != nil {
return nil, err
}
result := []aurora.ScheduleStatus{scheduleStatus}
return result, nil
}

View file

@ -15,6 +15,9 @@
package cmd
import (
"strconv"
"strings"
realis "github.com/aurora-scheduler/gorealis/v2"
"github.com/spf13/cobra"
)
@ -26,6 +29,7 @@ func init() {
// Kill Job
killCmd.AddCommand(killJobCmd)
killCmd.AddCommand(killTasksCmd)
killJobCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
killJobCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
@ -34,6 +38,17 @@ func init() {
killJobCmd.MarkFlagRequired("environment")
killJobCmd.MarkFlagRequired("role")
killJobCmd.MarkFlagRequired("name")
//Set flags for killTask sub-command
killTasksCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
killTasksCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
killTasksCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
killTasksCmd.Flags().StringVarP(instances, "instances", "I", "", "Instances e.g. 1, 2, 5")
killTasksCmd.Flags().BoolVarP(&monitor, "monitor", "m", true, "monitor the result after sending the command")
killTasksCmd.MarkFlagRequired("environment")
killTasksCmd.MarkFlagRequired("role")
killTasksCmd.MarkFlagRequired("name")
killTasksCmd.MarkFlagRequired("instances")
}
var killCmd = &cobra.Command{
@ -47,6 +62,24 @@ var killJobCmd = &cobra.Command{
Run: killJob,
}
/*
* The killTasks command allows the user to kill a specific task of a job.
* The command also allows the user to kill multiple tasks of the same job. To do so the user needs to pass a list of instance numbers as comma separated values.
* Pass the instance number of the job to be killed after the --instances or -I flag
* Please note that all the instances passed must belong to the same job.
*
* example : australis kill tasks -e "environment" -r "role" -n "job_name" -I "1"
* The above example kills instance number 1.
*
* example 2 : australis kill tasks -e "environment" -r "role" -n "job_name" -I "1, 5, 9"
* The above example kills tasks 1, 5 and 9, which are part of the same job
*/
var killTasksCmd = &cobra.Command{
Use: "tasks",
Short: "Kill Aurora Tasks",
Run: killTasks,
}
func killJob(cmd *cobra.Command, args []string) {
log.Infof("Killing job [Env:%s Role:%s Name:%s]\n", *env, *role, *name)
@ -64,3 +97,43 @@ func killJob(cmd *cobra.Command, args []string) {
}
}
}
func killTasks(cmd *cobra.Command, args []string) {
log.Infof("Killing task [Env:%s Role:%s Name:%s Instance:%s]\n", *env, *role, *name, *instances)
//Set jobKey for the tasks to be killed.
task := realis.NewTask().
Environment(*env).
Role(*role).
Name(*name)
/*
* In the following block, we convert instance numbers, which were passed as strings, to integer values
* After converting them to integers, we add them to a slice of type int32.
*/
splitString := strings.Split(*instances, ",")
instanceList := make([]int32, len(splitString))
for i := range instanceList {
splitString[i] = strings.TrimSpace(splitString[i])
instanceNumber, intErr := strconv.Atoi(splitString[i])
if intErr != nil {
log.Fatalln("Instance passed should be a number. Error: " + intErr.Error())
return
} else {
instanceList[i] = int32(instanceNumber)
}
}
//Call the killtasks function, passing the instanceList as the list of instances to be killed.
if _, err := client.KillInstances(task.JobKey(), instanceList...); err != nil {
log.Fatalln(err)
}
if monitor {
if ok, err := client.MonitorInstances(task.JobKey(), 0, 5, 50); !ok || err != nil {
log.Fatalln("Unable to kill the given task")
}
}
}

View file

@ -15,6 +15,11 @@
package cmd
import (
"strconv"
"strings"
realis "github.com/aurora-scheduler/gorealis/v2"
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
@ -26,6 +31,17 @@ func init() {
restartJobCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
restartJobCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
restartJobCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
restartCmd.AddCommand(restartTasksCmd)
restartTasksCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
restartTasksCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
restartTasksCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
restartTasksCmd.Flags().StringVarP(instances, "instances", "I", "", "Instances e.g. 1, 2, 5")
restartTasksCmd.Flags().BoolVarP(&monitor, "monitor", "m", true, "monitor the result after sending the command")
restartTasksCmd.MarkFlagRequired("environment")
restartTasksCmd.MarkFlagRequired("role")
restartTasksCmd.MarkFlagRequired("name")
restartTasksCmd.MarkFlagRequired("instances")
}
var restartCmd = &cobra.Command{
@ -39,9 +55,56 @@ var restartJobCmd = &cobra.Command{
Run: restartJob,
}
var restartTasksCmd = &cobra.Command{
Use: "tasks",
Short: "Restart tasks for a Job.",
Run: restartTasks,
}
func restartJob(cmd *cobra.Command, args []string) {
key := aurora.JobKey{Environment: *env, Role: *role, Name: *name}
if err := client.RestartJob(key); err != nil {
log.Fatal("unable to create Aurora job: ", err)
}
}
func restartTasks(cmd *cobra.Command, args []string) {
log.Infof("Restarts task [Env:%s Role:%s Name:%s Instance:%s Monitor:%s]\n", *env, *role, *name, *instances, strconv.FormatBool(monitor))
//Set jobKey for the tasks to be killed.
task := realis.NewTask().
Environment(*env).
Role(*role).
Name(*name)
/*
* In the following block, we convert instance numbers, which were passed as strings, to integer values
* After converting them to integers, we add them to a slice of type int32.
*/
splitString := strings.Split(*instances, ",")
instanceList := make([]int32, len(splitString))
for i := range instanceList {
splitString[i] = strings.TrimSpace(splitString[i])
var instanceNumber int
var err error
if instanceNumber, err = strconv.Atoi(splitString[i]); err != nil {
log.Fatalln("Instance passed should be a number. Error: " + err.Error())
return
}
instanceList[i] = int32(instanceNumber)
}
//Call the RestartInstances function, passing the instanceList as the list of instances to be restarted.
if err := client.RestartInstances(task.JobKey(), instanceList...); err != nil {
log.Fatalln(err)
}
if monitor {
if ok, err := client.MonitorInstances(task.JobKey(), int32(len(instanceList)), 5, 50); !ok || err != nil {
log.Fatalln("Monitor failed to monitor the given task after restart. Error: " + err.Error())
}
}
}

View file

@ -50,8 +50,10 @@ var updateID string
var monitor bool
var timeout time.Duration
var log = logrus.New()
var taskStatus = new(string)
var instances = new(string)
const australisVer = "v1.0.4"
const australisVer = "v1.0.5"
var forceDrainTimeout time.Duration

7
debian/changelog vendored
View file

@ -1,3 +1,10 @@
australis (1.0.5) stable; urgency=medium
* kill tasks
* fetch all aurora & mesos master nodes
-- Nhat Tan Le <maintainer@nhatle.xyz> Wed, 31 Aug 2022 15:03:24 -0700
australis (1.0.4) stable; urgency=medium
* fetch free capacity

View file

@ -37,7 +37,8 @@ A light-weight command line client for use with Apache Aurora built using goreal
* [australis rollback](australis_rollback.md) - Rollback an operation such as an Update
* [australis schedule](australis_schedule.md) - Schedule a cron job on Aurora scheduler
* [australis set](australis_set.md) - Set a value in the Aurora Scheduler.
* [australis simulate](australis_simulate.md) - Simulate some work based on the current cluster condition, and return the output
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
* [australis stop](australis_stop.md) - Stop a service or maintenance on a host (DRAIN).
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -38,4 +38,4 @@ australis create [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -32,9 +32,14 @@ Fetch information from Aurora
### SEE ALSO
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis fetch capacity](australis_fetch_capacity.md) - Fetch capacity report
* [australis fetch jobs](australis_fetch_jobs.md) - Fetch a list of task Aurora running under a role.
* [australis fetch leader](australis_fetch_leader.md) - Fetch current Aurora leader given Zookeeper nodes.
* [australis fetch master](australis_fetch_master.md) - Fetch current Aurora master nodes/leader given Zookeeper nodes.
* [australis fetch mesos](australis_fetch_mesos.md) - Fetch information from Mesos.
* [australis fetch quota](australis_fetch_quota.md) - Fetch the quotas of given roles
* [australis fetch status](australis_fetch_status.md) - Fetch the maintenance status of a node from Aurora
* [australis fetch task](australis_fetch_task.md) - Task information from Aurora
* [australis fetch tasks](australis_fetch_tasks.md) - Fetch tasks with status
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,40 @@
## australis fetch capacity
Fetch capacity report
### Synopsis
This command will show detailed capacity report of the cluster
```
australis fetch capacity [flags]
```
### Options
```
-h, --help help for capacity
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -38,4 +38,4 @@ australis fetch jobs [flags]
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -39,4 +39,4 @@ australis fetch leader [zkNode0, zkNode1, ...zkNodeN] [flags]
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,42 @@
## australis fetch master
Fetch current Aurora master nodes/leader given Zookeeper nodes.
### Synopsis
Gets the current aurora master nodes/leader using information from Zookeeper path.
Pass Zookeeper nodes separated by a space as an argument to this command.
```
australis fetch master [zkNode0 zkNode1 ...zkNodeN] [flags]
```
### Options
```
-h, --help help for master
--zkPath string Zookeeper node path to get master nodes/leader (default "/aurora/scheduler")
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,38 @@
## australis fetch mesos
Fetch information from Mesos.
### Synopsis
Fetch information from Mesos.
### Options
```
-h, --help help for mesos
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
* [australis fetch mesos leader](australis_fetch_mesos_leader.md) - Fetch current Mesos-master leader given Zookeeper nodes.
* [australis fetch mesos master](australis_fetch_mesos_master.md) - Fetch current Mesos-master nodes/leader given Zookeeper nodes.
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,43 @@
## australis fetch mesos leader
Fetch current Mesos-master leader given Zookeeper nodes.
### Synopsis
Gets the current leading Mesos-master instance using information from Zookeeper path.
Pass Zookeeper nodes separated by a space as an argument to this command. If no nodes are provided,
it fetches leader from local Mesos agent or Zookeeper
```
australis fetch mesos leader [zkNode0, zkNode1, ...zkNodeN] [flags]
```
### Options
```
-h, --help help for leader
--zkPath string Zookeeper node path where mesos leader election happens (default "/mesos")
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis fetch mesos](australis_fetch_mesos.md) - Fetch information from Mesos.
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,43 @@
## australis fetch mesos master
Fetch current Mesos-master nodes/leader given Zookeeper nodes.
### Synopsis
Gets the current Mesos-master instances using information from Zookeeper path.
Pass Zookeeper nodes separated by a space as an argument to this command. If no nodes are provided,
it fetches Mesos-master nodes/leader from local Mesos agent or Zookeeper
```
australis fetch mesos master [zkNode0 zkNode1 ...zkNodeN] [flags]
```
### Options
```
-h, --help help for master
--zkPath string Zookeeper node path to get mesos master nodes/leader (default "/mesos")
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis fetch mesos](australis_fetch_mesos.md) - Fetch information from Mesos.
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,40 @@
## australis fetch quota
Fetch the quotas of given roles
### Synopsis
This command will print list of resource quotas with the aggregated resources for the given roles
```
australis fetch quota [flags]
```
### Options
```
-h, --help help for quota
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -37,4 +37,4 @@ australis fetch status [flags]
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -35,4 +35,4 @@ Task information from Aurora
* [australis fetch task config](australis_fetch_task_config.md) - Fetch a list of task configurations from Aurora.
* [australis fetch task status](australis_fetch_task_status.md) - Fetch task status for a Job key.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -40,4 +40,4 @@ australis fetch task config [flags]
* [australis fetch task](australis_fetch_task.md) - Task information from Aurora
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -40,4 +40,4 @@ australis fetch task status [flags]
* [australis fetch task](australis_fetch_task.md) - Task information from Aurora
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,44 @@
## australis fetch tasks
Fetch tasks with status
### Synopsis
This command will return the list of tasks with a given status
```
australis fetch tasks [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for tasks
-n, --name string Aurora Name
-r, --role string Aurora Role
-x, --status string Task Status
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -36,4 +36,4 @@ Force the scheduler to do a snapshot, a backup, or a task reconciliation.
* [australis force recon](australis_force_recon.md) - Force the leading scheduler to perform a reconciliation.
* [australis force snapshot](australis_force_snapshot.md) - Force the leading scheduler to perform a Snapshot.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -38,4 +38,4 @@ australis force backup [flags]
* [australis force](australis_force.md) - Force the scheduler to do a snapshot, a backup, or a task reconciliation.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -42,4 +42,4 @@ state for all currently known non-terminal tasks.
* [australis force recon explicit](australis_force_recon_explicit.md) - Force the leading scheduler to perform an explicit recon.
* [australis force recon implicit](australis_force_recon_implicit.md) - Force the leading scheduler to perform an implicit recon.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -39,4 +39,4 @@ australis force recon explicit [batch_size] [flags]
* [australis force recon](australis_force_recon.md) - Force the leading scheduler to perform a reconciliation.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -38,4 +38,4 @@ australis force recon implicit [flags]
* [australis force recon](australis_force_recon.md) - Force the leading scheduler to perform a reconciliation.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -38,4 +38,4 @@ australis force snapshot [flags]
* [australis force](australis_force.md) - Force the scheduler to do a snapshot, a backup, or a task reconciliation.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -33,5 +33,6 @@ Kill an Aurora Job
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis kill job](australis_kill_job.md) - Kill an Aurora Job
* [australis kill tasks](australis_kill_tasks.md) - Kill Aurora Tasks
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -41,4 +41,4 @@ australis kill job [flags]
* [australis kill](australis_kill.md) - Kill an Aurora Job
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,45 @@
## australis kill tasks
Kill Aurora Tasks
### Synopsis
Kill Aurora Tasks
```
australis kill tasks [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for tasks
-I, --instances string Instances e.g. 1, 2, 5
-m, --monitor monitor the result after sending the command (default true)
-n, --name string Aurora Name
-r, --role string Aurora Role
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis kill](australis_kill.md) - Kill an Aurora Job
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -34,4 +34,4 @@ Watch for a specific state change
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis monitor hosts](australis_monitor_hosts.md) - Watch a host maintenance status until it enters one of the desired statuses.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -40,4 +40,4 @@ australis monitor hosts [flags]
* [australis monitor](australis_monitor.md) - Watch for a specific state change
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -41,4 +41,4 @@ australis pulse [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -34,4 +34,4 @@ Restart an Aurora Job.
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis restart job](australis_restart_job.md) - Restart a Job.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -40,4 +40,4 @@ australis restart job [flags]
* [australis restart](australis_restart.md) - Restart an Aurora Job.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,45 @@
## australis restart tasks
Restart tasks for a Job.
### Synopsis
Restart tasks for a Job.
```
australis restart tasks [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for tasks
-I, --instances string Instances e.g. 1, 2, 5
-m, --monitor monitor the result after sending the command (default true)
-n, --name string Aurora Name
-r, --role string Aurora Role
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis restart](australis_restart.md) - Restart an Aurora Job.
###### Auto generated by spf13/cobra on 21-Sep-2022

View file

@ -42,4 +42,4 @@ australis resume [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -34,4 +34,4 @@ Rollback an operation such as an Update
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis rollback update](australis_rollback_update.md) - Rollback an update
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -42,4 +42,4 @@ australis rollback update [flags]
* [australis rollback](australis_rollback.md) - Rollback an operation such as an Update
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -37,4 +37,4 @@ australis schedule [flags]
* [australis](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -34,4 +34,4 @@ Set a value in the Aurora Scheduler.
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis set quota](australis_set_quota.md) - Set Quota resources for a role.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -37,4 +37,4 @@ australis set quota <role> cpu:<value> ram:<value> disk:<value> [flags]
* [australis set](australis_set.md) - Set a value in the Aurora Scheduler.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,37 @@
## australis simulate
Simulate some work based on the current cluster condition, and return the output
### Synopsis
Simulate some work based on the current cluster condition, and return the output
### Options
```
-h, --help help for simulate
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis](australis.md) - australis is a client for Apache Aurora
* [australis simulate fit](australis_simulate_fit.md) - Compute how many tasks can we fit to a cluster
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,40 @@
## australis simulate fit
Compute how many tasks can we fit to a cluster
### Synopsis
Compute how many tasks can we fit to a cluster
```
australis simulate fit [flags]
```
### Options
```
-h, --help help for fit
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis simulate](australis_simulate.md) - Simulate some work based on the current cluster condition, and return the output
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -37,4 +37,4 @@ Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a back
* [australis start sla-drain](australis_start_sla-drain.md) - Place a list of space separated Mesos Agents into maintenance mode using SLA aware strategies.
* [australis start update](australis_start_update.md) - Start an update on an Aurora long running service.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -43,4 +43,4 @@ australis start drain [space separated host list or use JSON flags] [flags]
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -42,4 +42,4 @@ australis start maintenance [space separated host list or use JSON flags] [flags
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -51,4 +51,4 @@ australis start sla-drain [space separated host list or use JSON flags] [flags]
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -39,4 +39,4 @@ australis start update [update config] [flags]
* [australis start](australis_start.md) - Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -35,4 +35,4 @@ Stop a service or maintenance on a host (DRAIN).
* [australis stop drain](australis_stop_drain.md) - Stop maintenance on a host (move to NONE).
* [australis stop update](australis_stop_update.md) - Stop update
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -38,4 +38,4 @@ australis stop drain [space separated host list] [flags]
* [australis stop](australis_stop.md) - Stop a service or maintenance on a host (DRAIN).
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -40,4 +40,4 @@ australis stop update [update ID] [flags]
* [australis stop](australis_stop.md) - Stop a service or maintenance on a host (DRAIN).
###### Auto generated by spf13/cobra on 5-Nov-2020
###### Auto generated by spf13/cobra on 8-Sep-2022

6
go.mod
View file

@ -3,9 +3,7 @@ module github.com/aurora-scheduler/australis
go 1.15
require (
github.com/andygrunwald/megos v0.0.0-20210622170559-e9ff1cac83c5
github.com/aurora-scheduler/gorealis/v2 v2.28.0
github.com/gizak/termui/v3 v3.1.0
github.com/aurora-scheduler/gorealis/v2 v2.29.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.0.0
@ -15,4 +13,4 @@ require (
gopkg.in/yaml.v2 v2.2.8
)
replace github.com/apache/thrift v0.13.0 => github.com/ridv/thrift v0.13.2
replace github.com/apache/thrift v0.13.0 => github.com/ridv/thrift v0.13.2

View file

@ -93,7 +93,6 @@ func (j *Job) ToRealis() (*realis.AuroraJob, error) {
RAM(j.RAM).
Disk(j.Disk).
AddPorts(int(j.Port)).
GPU(j.GPU).
IsService(j.Service).
Tier(j.Tier).
Priority(j.Priority).
@ -101,6 +100,10 @@ func (j *Job) ToRealis() (*realis.AuroraJob, error) {
InstanceCount(j.Instances).
MaxFailure(j.MaxFailures)
if j.GPU > 0 {
auroraJob.GPU(j.GPU)
}
if j.CronSchedule != nil {
auroraJob.CronSchedule(*j.CronSchedule)
}