From d06530d0ca7b54c4a1fdc9623349d82270b7a917 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Thu, 7 May 2020 16:31:32 -0700 Subject: [PATCH 01/40] Adding sample update job. --- test/update_hello_world.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/update_hello_world.yaml diff --git a/test/update_hello_world.yaml b/test/update_hello_world.yaml new file mode 100644 index 0000000..4caae2d --- /dev/null +++ b/test/update_hello_world.yaml @@ -0,0 +1,28 @@ +--- +jobConfig: + environment: "prod" + role: "vagrant" + name: "hello_world" + cpu: 0.09 + ram: 64 + disk: 128 + instances: 1 + maxFailures: 1 + thermos: + - name: "bootstrap" + cmd: "echo bootstrapping" + - name: "hello_gorealis" + cmd: "while true; do echo hello world from gorealis; sleep 10; done" +updateSettings: + maxPerInstanceFailures: 1 + maxFailedInstances: 1 + minTimeInRunning: 1m + rollbackOnFailure: true + instanceRanges: + - first: 1 + last: 4 + pulseTimeout: 1m + strategy: + batch: + groupSize: 2 + autoPause: false \ No newline at end of file From 13fbbce8166f6fdbd14dbb07f001fdd1cea56de2 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Thu, 7 May 2020 16:37:19 -0700 Subject: [PATCH 02/40] Adding rudimentary test for unmarshaling cron job. --- internal/util_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/util_test.go b/internal/util_test.go index 3eadc23..05cb686 100644 --- a/internal/util_test.go +++ b/internal/util_test.go @@ -25,6 +25,12 @@ func TestUnmarshalJob(t *testing.T) { assert.NoError(t, err) } +func TestUnmarshalCron(t *testing.T) { + cron, err := UnmarshalJob("../test/hello_world_cron.yaml") + assert.NoError(t, err) + assert.NoError(t, cron.ValidateCron()) +} + func TestUnmarshalUpdate(t *testing.T) { _, err := UnmarshalUpdate("../test/update_hello_world.yaml") assert.NoError(t, err) From 090fdf1715010b8e9f67f05b329be6f22ee5185a Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Thu, 7 May 2020 16:46:05 -0700 Subject: [PATCH 03/40] Removing update settings from cron example as they're not needed. --- test/hello_world_cron.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/test/hello_world_cron.yaml b/test/hello_world_cron.yaml index ff43c08..eab0dce 100644 --- a/test/hello_world_cron.yaml +++ b/test/hello_world_cron.yaml @@ -13,16 +13,3 @@ thermos: cmd: "echo bootstrapping" - name: "hello_gorealis" cmd: "echo hello world from gorealis; sleep 10;" -updateSettings: - maxPerInstanceFailures: 1 - maxFailedInstances: 1 - minTimeInRunning: 1m - rollbackOnFailure: true - instanceRanges: - - start: 1 - end: 4 - blockIfNoPulseAfter: 1m - slaAware: false - strategy: - name: Batch - groupSize: 2 \ No newline at end of file From 82fe22e013933cea00e9f07ee71a2081cd578e27 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Thu, 7 May 2020 20:19:26 -0700 Subject: [PATCH 04/40] Adding minimum instances to test data for update. Changing YAML de-serializing field name to match the name od the struct member and to decrease ambiguity. --- internal/updateJob.go | 2 +- test/update_hello_world.yaml | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/updateJob.go b/internal/updateJob.go index 32cafd3..4100e8f 100644 --- a/internal/updateJob.go +++ b/internal/updateJob.go @@ -49,7 +49,7 @@ type UpdateStrategy struct { type UpdateSettings struct { MaxPerInstanceFailures int32 `yaml:"maxPerInstanceFailures"` MaxFailedInstances int32 `yaml:"maxFailedInstances"` - MinTimeInRunning time.Duration `yaml:"minTimeRunning"` + MinTimeInRunning time.Duration `yaml:"minTimeInRunning"` RollbackOnFailure bool `yaml:"rollbackOnFailure"` InstanceRanges []InstanceRange `yaml:"instanceRanges"` InstanceCount int32 `yaml:"instanceCount"` diff --git a/test/update_hello_world.yaml b/test/update_hello_world.yaml index 4caae2d..ae13c27 100644 --- a/test/update_hello_world.yaml +++ b/test/update_hello_world.yaml @@ -18,11 +18,12 @@ updateSettings: maxFailedInstances: 1 minTimeInRunning: 1m rollbackOnFailure: true + instanceCount: 1 instanceRanges: - first: 1 last: 4 pulseTimeout: 1m strategy: - batch: - groupSize: 2 - autoPause: false \ No newline at end of file + variableBatch: + groupSizes: [1,2,3] + autoPause: true From 5efbbce6c7aab69b798ec52bdc3b00fefe1225cc Mon Sep 17 00:00:00 2001 From: lenhattan86 Date: Wed, 30 Sep 2020 16:32:53 -0700 Subject: [PATCH 05/40] skip monitoring create/kill jobs (#13) Added flag -m and --monitor that can be set in order to monitor a job creation or a job kill. By default monitor is set to true. --- cmd/create.go | 20 +++++++++++--------- cmd/kill.go | 8 +++++--- cmd/root.go | 1 + 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/cmd/create.go b/cmd/create.go index c062c4c..fd95efc 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -21,13 +21,14 @@ import ( func init() { rootCmd.AddCommand(createCmd) + createCmd.Flags().BoolVarP(&monitor, "monitor", "m", false, "monitor the result after sending the command") } var createCmd = &cobra.Command{ Use: "create", Short: "Create an Aurora Job", Run: createJob, - Args: cobra.ExactArgs(1), + Args: cobra.RangeArgs(1, 2), } func createJob(cmd *cobra.Command, args []string) { @@ -46,14 +47,15 @@ func createJob(cmd *cobra.Command, args []string) { log.Fatal("unable to create Aurora job: ", err) } - if ok, monitorErr := client.MonitorInstances(auroraJob.JobKey(), - auroraJob.GetInstanceCount(), - 5, - 50); !ok || monitorErr != nil { - if err := client.KillJob(auroraJob.JobKey()); err != nil { - log.Fatal(monitorErr, err) + if monitor { + if ok, monitorErr := client.MonitorInstances(auroraJob.JobKey(), + auroraJob.GetInstanceCount(), + 5, + 50); !ok || monitorErr != nil { + if err := client.KillJob(auroraJob.JobKey()); err != nil { + log.Fatal(monitorErr, err) + } + log.Fatal(monitorErr) } - log.Fatal(monitorErr) } - } diff --git a/cmd/kill.go b/cmd/kill.go index 3c3542b..0eb46c1 100644 --- a/cmd/kill.go +++ b/cmd/kill.go @@ -30,6 +30,7 @@ func init() { killJobCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment") killJobCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role") killJobCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name") + killJobCmd.Flags().BoolVarP(&monitor, "monitor", "m", false, "monitor the result after sending the command") killJobCmd.MarkFlagRequired("environment") killJobCmd.MarkFlagRequired("role") killJobCmd.MarkFlagRequired("name") @@ -57,8 +58,9 @@ func killJob(cmd *cobra.Command, args []string) { if err != nil { log.Fatalln(err) } - - if ok, err := client.MonitorInstances(job.JobKey(), 0, 5, 50); !ok || err != nil { - log.Fatalln("Unable to kill all instances of job") + if monitor { + if ok, err := client.MonitorInstances(job.JobKey(), 0, 5, 50); !ok || err != nil { + log.Fatalln("Unable to kill all instances of job") + } } } diff --git a/cmd/root.go b/cmd/root.go index ad50772..671cd30 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -46,6 +46,7 @@ var count int64 var filename string var message = new(string) var updateID string +var monitor bool var log = logrus.New() const australisVer = "v0.22.0" From deaddd29531da8db16a50eff578596f1236a60f4 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Wed, 30 Sep 2020 16:15:21 -0700 Subject: [PATCH 06/40] Bumping up release number in root.go so that version command returns the right version. Fixing some bugs in the debian packaging scripts. Bumping up golang version we're building with to 1.15.2 --- cmd/root.go | 2 +- deb-packaging/Dockerfile | 2 +- deb-packaging/build_deb.sh | 2 +- deb-packaging/entrypoint.sh | 5 +---- debian/changelog | 14 +++++++++++--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 671cd30..6e503cf 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -49,7 +49,7 @@ var updateID string var monitor bool var log = logrus.New() -const australisVer = "v0.22.0" +const australisVer = "v1.0.0" var forceDrainTimeout time.Duration diff --git a/deb-packaging/Dockerfile b/deb-packaging/Dockerfile index ab6b14e..6088aa8 100644 --- a/deb-packaging/Dockerfile +++ b/deb-packaging/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:16.04 RUN apt-get update -y && \ apt-get install -y build-essential devscripts dh-exec dh-make git lintian wget && \ - wget https://dl.google.com/go/go1.12.6.linux-amd64.tar.gz -O /tmp/go.tar.gz + wget https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz -O /tmp/go.tar.gz RUN tar -C /usr/local -xzf /tmp/go.tar.gz diff --git a/deb-packaging/build_deb.sh b/deb-packaging/build_deb.sh index 6906d3d..958eaa8 100644 --- a/deb-packaging/build_deb.sh +++ b/deb-packaging/build_deb.sh @@ -2,4 +2,4 @@ docker build . -t australis_deb_builder -docker run --rm -v $HOME/go/pkg/mod:/go/pkg/mod -v $(pwd)/..:/australis australis_builder +docker run --rm -v $HOME/go/pkg/mod:/go/pkg/mod -v $(pwd)/..:/australis australis_deb_builder diff --git a/deb-packaging/entrypoint.sh b/deb-packaging/entrypoint.sh index b871d59..601733e 100755 --- a/deb-packaging/entrypoint.sh +++ b/deb-packaging/entrypoint.sh @@ -1,12 +1,9 @@ #!/bin/bash -# Temporary fix for a go mods bug -rm /australis/go.sum - # Build debian package cd /australis debuild -d -us -uc -b # Move resulting packages to the dist folder mkdir -p /australis/dist -mv /australis_*_amd64* /australis/dist \ No newline at end of file +mv /australis_*_amd64* /australis/dist diff --git a/debian/changelog b/debian/changelog index 50dc650..0677aa4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,16 @@ -australis (0.1.2) unstable; urgency=medium +australis (1.0.0) stable; urgency=medium - * Unreleased + * First stable release. - -- Renan DelValle Mon, 19 Feb 2020 12:00:00 -0700 + -- Renan Del Valle Wed, 30 Sep 2020 15:39:29 -0700 + +australis (0.22.0) unstable; urgency=medium + + * Added support for starting job updates. + * Added support for setting SlaAwareness for updates. + * Added upport for scheduling cron jobs. + + -- Renan Del Valle Thu, 07 May 2020 12:00:00 -0700 australis (0.1.1) unstable; urgency=medium From d5d19cf4486648e283cf86eab76ee5467736c725 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Wed, 30 Sep 2020 16:46:14 -0700 Subject: [PATCH 07/40] Changing default value of monitor to true. --- cmd/create.go | 2 +- cmd/kill.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/create.go b/cmd/create.go index fd95efc..6ea8b93 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -21,7 +21,7 @@ import ( func init() { rootCmd.AddCommand(createCmd) - createCmd.Flags().BoolVarP(&monitor, "monitor", "m", false, "monitor the result after sending the command") + createCmd.Flags().BoolVarP(&monitor, "monitor", "m", true, "monitor the result after sending the command") } var createCmd = &cobra.Command{ diff --git a/cmd/kill.go b/cmd/kill.go index 0eb46c1..88d1d9f 100644 --- a/cmd/kill.go +++ b/cmd/kill.go @@ -30,7 +30,7 @@ func init() { killJobCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment") killJobCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role") killJobCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name") - killJobCmd.Flags().BoolVarP(&monitor, "monitor", "m", false, "monitor the result after sending the command") + killJobCmd.Flags().BoolVarP(&monitor, "monitor", "m", true, "monitor the result after sending the command") killJobCmd.MarkFlagRequired("environment") killJobCmd.MarkFlagRequired("role") killJobCmd.MarkFlagRequired("name") From 2a76e3e2b4e75ee6480466109cb7db8d0c04e8d3 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Wed, 30 Sep 2020 16:47:53 -0700 Subject: [PATCH 08/40] 1.0.1 release --- cmd/root.go | 2 +- debian/changelog | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index 6e503cf..d91a48b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -49,7 +49,7 @@ var updateID string var monitor bool var log = logrus.New() -const australisVer = "v1.0.0" +const australisVer = "v1.0.1" var forceDrainTimeout time.Duration diff --git a/debian/changelog b/debian/changelog index 0677aa4..96a761f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +australis (1.0.1) stable; urgency=medium + + * Added flag -m and --monitor that can be set in order to monitor a job creation or a job kill. By default monitor is set to true. + + -- Renan Del Valle Wed, 30 Sep 2020 16:46:56 -0700 + australis (1.0.0) stable; urgency=medium * First stable release. From bb370151e6b50b3098fd43976cc7f8aed3c778b0 Mon Sep 17 00:00:00 2001 From: lenhattan86 Date: Thu, 8 Oct 2020 09:01:56 -0700 Subject: [PATCH 09/40] Add gorealis timeout flag (#14) Flag was added to control gorealis timeout --- cmd/root.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index d91a48b..89ef33f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -47,6 +47,7 @@ var filename string var message = new(string) var updateID string var monitor bool +var timeout time.Duration // seconds var log = logrus.New() const australisVer = "v1.0.1" @@ -68,6 +69,7 @@ func init() { rootCmd.PersistentFlags().StringVar(&configFile, "config", "/etc/aurora/australis.yml", "Config file to use.") rootCmd.PersistentFlags().BoolVar(&toJson, "toJSON", false, "Print output in JSON format.") rootCmd.PersistentFlags().StringVarP(&logLevel, "logLevel", "l", "info", "Set logging level ["+internal.GetLoggingLevels()+"].") + rootCmd.PersistentFlags().DurationVarP(&timeout, "timeout", "t", 20, "Gorealis timeout (default: 20 seconds)") } var rootCmd = &cobra.Command{ @@ -142,7 +144,7 @@ func connect(cmd *cobra.Command, args []string) { realisOptions := []realis.ClientOption{realis.BasicAuth(username, password), realis.ThriftJSON(), - realis.Timeout(20 * time.Second), + realis.Timeout(timeout * time.Second), realis.BackOff(realis.Backoff{ Steps: 2, Duration: 10 * time.Second, From 7967188513e4f3a75027c502b085d58dfd582f95 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Wed, 14 Oct 2020 20:17:43 -0700 Subject: [PATCH 10/40] Fixing issue where duration variable was accidentally multiplied by seconds again. --- cmd/root.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 89ef33f..b16b2cb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -69,7 +69,7 @@ func init() { rootCmd.PersistentFlags().StringVar(&configFile, "config", "/etc/aurora/australis.yml", "Config file to use.") rootCmd.PersistentFlags().BoolVar(&toJson, "toJSON", false, "Print output in JSON format.") rootCmd.PersistentFlags().StringVarP(&logLevel, "logLevel", "l", "info", "Set logging level ["+internal.GetLoggingLevels()+"].") - rootCmd.PersistentFlags().DurationVarP(&timeout, "timeout", "t", 20, "Gorealis timeout (default: 20 seconds)") + rootCmd.PersistentFlags().DurationVarP(&timeout, "timeout", "t", 20 * time.Second, "Gorealis timeout.") } var rootCmd = &cobra.Command{ @@ -144,7 +144,7 @@ func connect(cmd *cobra.Command, args []string) { realisOptions := []realis.ClientOption{realis.BasicAuth(username, password), realis.ThriftJSON(), - realis.Timeout(timeout * time.Second), + realis.Timeout(timeout), realis.BackOff(realis.Backoff{ Steps: 2, Duration: 10 * time.Second, From a7750c5c98e0d453830ea19cebf12b29d28a5e3e Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Wed, 14 Oct 2020 20:27:25 -0700 Subject: [PATCH 11/40] Adding simple goimports check and build check CI. --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..869d257 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup Go for use with actions + uses: actions/setup-go@v1.0.0 + with: + version: 1.15 + - name: Install goimports + run: go get golang.org/x/tools/cmd/goimports + - name: Run goimports check + run: test -z "`for d in $GO_USR_DIRS; do goimports -d $d/*.go | tee /dev/stderr; done`" + env: + GO_USR_DIRS: $(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") + - name: Run tests + run: go build -o australis *.go From 7e7c88723129e19a7b551ca4ecf270990432031a Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Wed, 14 Oct 2020 20:32:34 -0700 Subject: [PATCH 12/40] Bumping up go setup in CI to v2. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 869d257..9a4d02c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Setup Go for use with actions - uses: actions/setup-go@v1.0.0 + uses: actions/setup-go@v2 with: - version: 1.15 + go-version: 1.15 - name: Install goimports run: go get golang.org/x/tools/cmd/goimports - name: Run goimports check From 99af97736cdba2dc3d3f58c52899ae30d9d6ab85 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Wed, 14 Oct 2020 20:46:32 -0700 Subject: [PATCH 13/40] Fixing goimports call --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a4d02c..16b4952 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Install goimports run: go get golang.org/x/tools/cmd/goimports - name: Run goimports check - run: test -z "`for d in $GO_USR_DIRS; do goimports -d $d/*.go | tee /dev/stderr; done`" + run: test -z `for d in $GO_USR_DIRS; do goimports -d "$d" | tee /dev/stderr; done` env: GO_USR_DIRS: $(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") - name: Run tests From cea39ddd887e82aedaa57d9fd66b4e12fd3d4978 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Wed, 14 Oct 2020 20:46:50 -0700 Subject: [PATCH 14/40] Fixing all files to conform with goimports. --- cmd/completion.go | 1 - cmd/restart.go | 33 ++++++++++++++++----------------- cmd/root.go | 2 +- internal/util_test.go | 1 - 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/cmd/completion.go b/cmd/completion.go index efc260e..258a45f 100644 --- a/cmd/completion.go +++ b/cmd/completion.go @@ -42,4 +42,3 @@ In MacOS this directory is $(brew --prefix)/etc/bash_completion.d if auto comple rootCmd.GenBashCompletionFile(filename) }, } - diff --git a/cmd/restart.go b/cmd/restart.go index e5f8701..d90d5fd 100644 --- a/cmd/restart.go +++ b/cmd/restart.go @@ -15,34 +15,33 @@ package cmd import ( - "github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora" - "github.com/spf13/cobra" + "github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora" + "github.com/spf13/cobra" ) func init() { - rootCmd.AddCommand(restartCmd) + rootCmd.AddCommand(restartCmd) - - restartCmd.AddCommand(restartJobCmd) - 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(restartJobCmd) + restartJobCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment") + restartJobCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role") + restartJobCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name") } var restartCmd = &cobra.Command{ - Use: "restart", - Short: "Restart an Aurora Job.", + Use: "restart", + Short: "Restart an Aurora Job.", } var restartJobCmd = &cobra.Command{ - Use: "job", - Short: "Restart a Job.", - Run: restartJob, + Use: "job", + Short: "Restart a Job.", + Run: restartJob, } 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) - } + key := aurora.JobKey{Environment: *env, Role: *role, Name: *name} + if err := client.RestartJob(key); err != nil { + log.Fatal("unable to create Aurora job: ", err) + } } diff --git a/cmd/root.go b/cmd/root.go index b16b2cb..3b5889d 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -69,7 +69,7 @@ func init() { rootCmd.PersistentFlags().StringVar(&configFile, "config", "/etc/aurora/australis.yml", "Config file to use.") rootCmd.PersistentFlags().BoolVar(&toJson, "toJSON", false, "Print output in JSON format.") rootCmd.PersistentFlags().StringVarP(&logLevel, "logLevel", "l", "info", "Set logging level ["+internal.GetLoggingLevels()+"].") - rootCmd.PersistentFlags().DurationVarP(&timeout, "timeout", "t", 20 * time.Second, "Gorealis timeout.") + rootCmd.PersistentFlags().DurationVarP(&timeout, "timeout", "t", 20*time.Second, "Gorealis timeout.") } var rootCmd = &cobra.Command{ diff --git a/internal/util_test.go b/internal/util_test.go index 05cb686..7853ce9 100644 --- a/internal/util_test.go +++ b/internal/util_test.go @@ -35,4 +35,3 @@ func TestUnmarshalUpdate(t *testing.T) { _, err := UnmarshalUpdate("../test/update_hello_world.yaml") assert.NoError(t, err) } - From 464ef72e6b24811cf6455aed522ccf49a4fc99b9 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Wed, 14 Oct 2020 20:53:32 -0700 Subject: [PATCH 15/40] Changing style of setting up github actions env due to the deprecation of the old way. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16b4952..7696b1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,9 @@ jobs: go-version: 1.15 - name: Install goimports run: go get golang.org/x/tools/cmd/goimports + - name: Set env with list of directories in repo containin go code + run: echo GO_USR_DIRS=$(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") >> $GITHUB_ENV - name: Run goimports check run: test -z `for d in $GO_USR_DIRS; do goimports -d "$d" | tee /dev/stderr; done` - env: - GO_USR_DIRS: $(go list -f {{.Dir}} ./... | grep -E -v "/gen-go/|/vendor/") - name: Run tests run: go build -o australis *.go From 9fa6edaa3e98ed386bdaabe1c493eff21e6efe80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A1n=20I=2E=20Del=20Valle?= Date: Wed, 4 Nov 2020 11:46:53 -0800 Subject: [PATCH 16/40] Adds support for creating jobs with limit constraints and value constraints. (#16) * Adds support for creating jobs with limit constraints and value constraints. --- internal/job.go | 23 +++++++++++++++++++++++ internal/util_test.go | 5 +++++ test/hello_world_dedicated.yaml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 test/hello_world_dedicated.yaml diff --git a/internal/job.go b/internal/job.go index dcbf771..bdde546 100644 --- a/internal/job.go +++ b/internal/job.go @@ -47,6 +47,17 @@ type Container struct { Docker *DockerContainer `yaml:"docker"` } +type ValueConstraint struct { + Name string `yaml:"name"` + Values []string `yaml:"values"` + Negated bool `yaml:"negated"` +} + +type LimitConstraint struct { + Name string `yaml:"name"` + Limit int32 `yaml:"limit"` +} + type Job struct { Environment string `yaml:"environment"` Role string `yaml:"role"` @@ -64,6 +75,8 @@ type Job struct { Container *Container `yaml:"container,omitempty"` CronSchedule *string `yaml:"cronSchedule,omitempty"` CronCollisionPolicy *string `yaml:"cronCollisionPolicy,omitempty"` + ValueConstraints []ValueConstraint `yaml:"valueConstraints,flow,omitempty"` + LimitConstraints []LimitConstraint `yaml:"limitConstraints,flow,omitempty"` } func (j *Job) ToRealis() (*realis.AuroraJob, error) { @@ -125,6 +138,15 @@ func (j *Job) ToRealis() (*realis.AuroraJob, error) { } + // Setting Constraints + for _, valConstraint := range j.ValueConstraints { + auroraJob.AddValueConstraint(valConstraint.Name, valConstraint.Negated, valConstraint.Values...) + } + + for _, limit := range j.LimitConstraints { + auroraJob.AddLimitConstraint(limit.Name, limit.Limit) + } + return auroraJob, nil } @@ -162,6 +184,7 @@ func (j *Job) Validate() error { } return nil } + func (j *Job) ValidateCron() error { if j.CronSchedule == nil { return errors.New("cron schedule must be set") diff --git a/internal/util_test.go b/internal/util_test.go index 7853ce9..366ffb0 100644 --- a/internal/util_test.go +++ b/internal/util_test.go @@ -25,6 +25,11 @@ func TestUnmarshalJob(t *testing.T) { assert.NoError(t, err) } +func TestUnmarshalDedicatedJob(t *testing.T) { + _, err := UnmarshalJob("../test/hello_world_dedicated.yaml") + assert.NoError(t, err) +} + func TestUnmarshalCron(t *testing.T) { cron, err := UnmarshalJob("../test/hello_world_cron.yaml") assert.NoError(t, err) diff --git a/test/hello_world_dedicated.yaml b/test/hello_world_dedicated.yaml new file mode 100644 index 0000000..95dac27 --- /dev/null +++ b/test/hello_world_dedicated.yaml @@ -0,0 +1,30 @@ +--- +environment: "prod" +role: "vagrant" +name: "hello_world" +cpu: 0.09 +ram: 64 +disk: 128 +instances: 1 +valueConstraints: + - name: "dedicated" + values: + - "vagrant/bar" +thermos: + - name: "bootstrap" + cmd: "echo bootstrapping" + - name: "hello_gorealis" + cmd: "while true; do echo hello world from gorealis; sleep 10; done" +updateSettings: + maxPerInstanceFailures: 1 + maxFailedInstances: 1 + minTimeInRunning: 1m + rollbackOnFailure: true + instanceRanges: + - start: 1 + end: 4 + blockIfNoPulseAfter: 1m + slaAware: false + strategy: + name: Batch + groupSize: 2 \ No newline at end of file From be6c458f232b37c7b2419c5bf596ccbbc766b592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A1n=20I=2E=20Del=20Valle?= Date: Thu, 5 Nov 2020 15:46:07 -0800 Subject: [PATCH 17/40] Documentation update (#17) * Updates documentation automatically generated by Cobra. Deletes some old, outdated documentation. --- docs/australis.md | 3 +- docs/australis_create.md | 6 ++- docs/australis_fetch.md | 3 +- docs/australis_fetch_jobs.md | 3 +- docs/australis_fetch_leader.md | 3 +- docs/australis_fetch_status.md | 3 +- docs/australis_fetch_task.md | 3 +- docs/australis_fetch_task_config.md | 3 +- docs/australis_fetch_task_status.md | 3 +- docs/australis_force.md | 3 +- docs/australis_force_backup.md | 3 +- docs/australis_force_recon.md | 3 +- docs/australis_force_recon_explicit.md | 3 +- docs/australis_force_recon_implicit.md | 3 +- docs/australis_force_snapshot.md | 3 +- docs/australis_kill.md | 3 +- docs/australis_kill_entire-cluster.md | 39 ----------------- docs/australis_kill_job.md | 4 +- docs/australis_monitor.md | 3 +- docs/australis_monitor_hosts.md | 4 +- docs/australis_pulse.md | 3 +- docs/australis_restart.md | 3 +- docs/australis_restart_job.md | 3 +- docs/australis_resume.md | 3 +- docs/australis_rollback.md | 3 +- docs/australis_rollback_update.md | 3 +- docs/australis_schedule.md | 3 +- docs/australis_set.md | 3 +- docs/australis_set_quota.md | 3 +- docs/australis_start.md | 3 +- docs/australis_start_drain.md | 4 +- docs/australis_start_maintenance.md | 4 +- docs/australis_start_sla-drain.md | 4 +- docs/australis_start_sla-drain_count.md | 45 -------------------- docs/australis_start_sla-drain_percentage.md | 45 -------------------- docs/australis_start_update.md | 4 +- docs/australis_stop.md | 3 +- docs/australis_stop_drain.md | 4 +- docs/australis_stop_update.md | 3 +- 39 files changed, 75 insertions(+), 172 deletions(-) delete mode 100644 docs/australis_kill_entire-cluster.md delete mode 100644 docs/australis_start_sla-drain_count.md delete mode 100644 docs/australis_start_sla-drain_percentage.md diff --git a/docs/australis.md b/docs/australis.md index 1374c86..352c6f6 100644 --- a/docs/australis.md +++ b/docs/australis.md @@ -18,6 +18,7 @@ A light-weight command line client for use with Apache Aurora built using goreal -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) @@ -39,4 +40,4 @@ A light-weight command line client for use with Apache Aurora built using goreal * [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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_create.md b/docs/australis_create.md index 3a605c8..8069bc2 100644 --- a/docs/australis_create.md +++ b/docs/australis_create.md @@ -13,7 +13,8 @@ australis create [flags] ### Options ``` - -h, --help help for create + -h, --help help for create + -m, --monitor monitor the result after sending the command (default true) ``` ### Options inherited from parent commands @@ -27,6 +28,7 @@ australis create [flags] -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) @@ -36,4 +38,4 @@ australis create [flags] * [australis](australis.md) - australis is a client for Apache Aurora -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_fetch.md b/docs/australis_fetch.md index d229a42..2f365c8 100644 --- a/docs/australis_fetch.md +++ b/docs/australis_fetch.md @@ -23,6 +23,7 @@ Fetch information from Aurora -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) @@ -36,4 +37,4 @@ Fetch information from Aurora * [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 -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_fetch_jobs.md b/docs/australis_fetch_jobs.md index ad9c045..2f2dc6c 100644 --- a/docs/australis_fetch_jobs.md +++ b/docs/australis_fetch_jobs.md @@ -28,6 +28,7 @@ australis fetch jobs [flags] -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) @@ -37,4 +38,4 @@ australis fetch jobs [flags] * [australis fetch](australis_fetch.md) - Fetch information from Aurora -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_fetch_leader.md b/docs/australis_fetch_leader.md index e69dab3..dd99c47 100644 --- a/docs/australis_fetch_leader.md +++ b/docs/australis_fetch_leader.md @@ -29,6 +29,7 @@ australis fetch leader [zkNode0, zkNode1, ...zkNodeN] [flags] -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) @@ -38,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_fetch_status.md b/docs/australis_fetch_status.md index 62f944e..373ceaa 100644 --- a/docs/australis_fetch_status.md +++ b/docs/australis_fetch_status.md @@ -27,6 +27,7 @@ australis fetch status [flags] -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) @@ -36,4 +37,4 @@ australis fetch status [flags] * [australis fetch](australis_fetch.md) - Fetch information from Aurora -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_fetch_task.md b/docs/australis_fetch_task.md index b902053..70fff8e 100644 --- a/docs/australis_fetch_task.md +++ b/docs/australis_fetch_task.md @@ -23,6 +23,7 @@ Task information from Aurora -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) @@ -34,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_fetch_task_config.md b/docs/australis_fetch_task_config.md index 88e6c56..6dae394 100644 --- a/docs/australis_fetch_task_config.md +++ b/docs/australis_fetch_task_config.md @@ -30,6 +30,7 @@ australis fetch task config [flags] -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) @@ -39,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_fetch_task_status.md b/docs/australis_fetch_task_status.md index f378e3c..5cbdf79 100644 --- a/docs/australis_fetch_task_status.md +++ b/docs/australis_fetch_task_status.md @@ -30,6 +30,7 @@ australis fetch task status [flags] -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) @@ -39,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_force.md b/docs/australis_force.md index cd62da0..6aaccb3 100644 --- a/docs/australis_force.md +++ b/docs/australis_force.md @@ -23,6 +23,7 @@ Force the scheduler to do a snapshot, a backup, or a task reconciliation. -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) @@ -35,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_force_backup.md b/docs/australis_force_backup.md index 453c91f..1fd0a74 100644 --- a/docs/australis_force_backup.md +++ b/docs/australis_force_backup.md @@ -28,6 +28,7 @@ australis force backup [flags] -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) @@ -37,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_force_recon.md b/docs/australis_force_recon.md index 17758d2..9907fed 100644 --- a/docs/australis_force_recon.md +++ b/docs/australis_force_recon.md @@ -30,6 +30,7 @@ state for all currently known non-terminal tasks. -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) @@ -41,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_force_recon_explicit.md b/docs/australis_force_recon_explicit.md index 802450b..113316c 100644 --- a/docs/australis_force_recon_explicit.md +++ b/docs/australis_force_recon_explicit.md @@ -29,6 +29,7 @@ australis force recon explicit [batch_size] [flags] -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) @@ -38,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_force_recon_implicit.md b/docs/australis_force_recon_implicit.md index ff30e2b..932f390 100644 --- a/docs/australis_force_recon_implicit.md +++ b/docs/australis_force_recon_implicit.md @@ -28,6 +28,7 @@ australis force recon implicit [flags] -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) @@ -37,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_force_snapshot.md b/docs/australis_force_snapshot.md index 8ce8081..f6207a3 100644 --- a/docs/australis_force_snapshot.md +++ b/docs/australis_force_snapshot.md @@ -28,6 +28,7 @@ australis force snapshot [flags] -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) @@ -37,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_kill.md b/docs/australis_kill.md index 89e914d..69403b7 100644 --- a/docs/australis_kill.md +++ b/docs/australis_kill.md @@ -23,6 +23,7 @@ Kill an Aurora Job -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) @@ -33,4 +34,4 @@ 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 -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_kill_entire-cluster.md b/docs/australis_kill_entire-cluster.md deleted file mode 100644 index 5d8585d..0000000 --- a/docs/australis_kill_entire-cluster.md +++ /dev/null @@ -1,39 +0,0 @@ -## australis kill entire-cluster - -Kill every task in the cluster. - -### Synopsis - -To be written. - -``` -australis kill entire-cluster [flags] -``` - -### Options - -``` - -h, --help help for entire-cluster -``` - -### 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. - --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 22-Mar-2019 diff --git a/docs/australis_kill_job.md b/docs/australis_kill_job.md index 0a12da3..56446f3 100644 --- a/docs/australis_kill_job.md +++ b/docs/australis_kill_job.md @@ -15,6 +15,7 @@ australis kill job [flags] ``` -e, --environment string Aurora Environment -h, --help help for job + -m, --monitor monitor the result after sending the command (default true) -n, --name string Aurora Name -r, --role string Aurora Role ``` @@ -30,6 +31,7 @@ australis kill job [flags] -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) @@ -39,4 +41,4 @@ australis kill job [flags] * [australis kill](australis_kill.md) - Kill an Aurora Job -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_monitor.md b/docs/australis_monitor.md index aa77d1c..59ba91a 100644 --- a/docs/australis_monitor.md +++ b/docs/australis_monitor.md @@ -23,6 +23,7 @@ Watch for a specific state change -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) @@ -33,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_monitor_hosts.md b/docs/australis_monitor_hosts.md index 4dd1ded..508fb68 100644 --- a/docs/australis_monitor_hosts.md +++ b/docs/australis_monitor_hosts.md @@ -17,7 +17,6 @@ australis monitor hosts [flags] -h, --help help for hosts --interval duration Interval at which to poll scheduler. (default 5s) --statuses strings List of acceptable statuses for a host to be in. (case-insensitive) [NONE, SCHEDULED, DRAINED, DRAINING] (default [DRAINED]) - --timeout duration Time after which the monitor will stop polling and throw an error. (default 10m0s) ``` ### Options inherited from parent commands @@ -31,6 +30,7 @@ australis monitor hosts [flags] -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) @@ -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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_pulse.md b/docs/australis_pulse.md index 0dc480a..904e253 100644 --- a/docs/australis_pulse.md +++ b/docs/australis_pulse.md @@ -31,6 +31,7 @@ australis pulse [flags] -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) @@ -40,4 +41,4 @@ australis pulse [flags] * [australis](australis.md) - australis is a client for Apache Aurora -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_restart.md b/docs/australis_restart.md index 79037d4..6b1aa9f 100644 --- a/docs/australis_restart.md +++ b/docs/australis_restart.md @@ -23,6 +23,7 @@ Restart an Aurora Job. -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) @@ -33,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_restart_job.md b/docs/australis_restart_job.md index 4225b66..219c3c2 100644 --- a/docs/australis_restart_job.md +++ b/docs/australis_restart_job.md @@ -30,6 +30,7 @@ australis restart job [flags] -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) @@ -39,4 +40,4 @@ australis restart job [flags] * [australis restart](australis_restart.md) - Restart an Aurora Job. -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_resume.md b/docs/australis_resume.md index f7697c4..cd9b899 100644 --- a/docs/australis_resume.md +++ b/docs/australis_resume.md @@ -32,6 +32,7 @@ australis resume [flags] -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) @@ -41,4 +42,4 @@ australis resume [flags] * [australis](australis.md) - australis is a client for Apache Aurora -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_rollback.md b/docs/australis_rollback.md index 7b0f871..3c6fc7d 100644 --- a/docs/australis_rollback.md +++ b/docs/australis_rollback.md @@ -23,6 +23,7 @@ Rollback an operation such as an Update -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) @@ -33,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_rollback_update.md b/docs/australis_rollback_update.md index 5d798ba..5e45946 100644 --- a/docs/australis_rollback_update.md +++ b/docs/australis_rollback_update.md @@ -32,6 +32,7 @@ australis rollback update [flags] -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) @@ -41,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_schedule.md b/docs/australis_schedule.md index 0218243..ff97b70 100644 --- a/docs/australis_schedule.md +++ b/docs/australis_schedule.md @@ -27,6 +27,7 @@ australis schedule [flags] -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) @@ -36,4 +37,4 @@ australis schedule [flags] * [australis](australis.md) - australis is a client for Apache Aurora -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_set.md b/docs/australis_set.md index 6efb0b4..6973c69 100644 --- a/docs/australis_set.md +++ b/docs/australis_set.md @@ -23,6 +23,7 @@ Set a value in the Aurora Scheduler. -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) @@ -33,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_set_quota.md b/docs/australis_set_quota.md index 555f195..3e29bb3 100644 --- a/docs/australis_set_quota.md +++ b/docs/australis_set_quota.md @@ -27,6 +27,7 @@ australis set quota cpu: ram: disk: [flags] -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) @@ -36,4 +37,4 @@ australis set quota cpu: ram: disk: [flags] * [australis set](australis_set.md) - Set a value in the Aurora Scheduler. -###### Auto generated by spf13/cobra on 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_start.md b/docs/australis_start.md index b4390c7..9a8a8dd 100644 --- a/docs/australis_start.md +++ b/docs/australis_start.md @@ -23,6 +23,7 @@ Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a back -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) @@ -36,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_start_drain.md b/docs/australis_start_drain.md index 5462952..2073cd4 100644 --- a/docs/australis_start_drain.md +++ b/docs/australis_start_drain.md @@ -20,7 +20,6 @@ australis start drain [space separated host list or use JSON flags] [flags] --interval duration Interval at which to poll scheduler. (default 5s) --json Read JSON list of agents from the STDIN. --json-file string JSON file to read list of agents from. - --timeout duration Time after which the monitor will stop polling and throw an error. (default 10m0s) ``` ### Options inherited from parent commands @@ -34,6 +33,7 @@ australis start drain [space separated host list or use JSON flags] [flags] -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) @@ -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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_start_maintenance.md b/docs/australis_start_maintenance.md index ff93667..51db1de 100644 --- a/docs/australis_start_maintenance.md +++ b/docs/australis_start_maintenance.md @@ -19,7 +19,6 @@ australis start maintenance [space separated host list or use JSON flags] [flags --interval duration Interval at which to poll scheduler. (default 5s) --json Read JSON list of agents from the STDIN. --json-file string JSON file to read list of agents from. - --timeout duration Time after which the monitor will stop polling and throw an error. (default 10m0s) ``` ### Options inherited from parent commands @@ -33,6 +32,7 @@ australis start maintenance [space separated host list or use JSON flags] [flags -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) @@ -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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_start_sla-drain.md b/docs/australis_start_sla-drain.md index 831507d..3c0263d 100644 --- a/docs/australis_start_sla-drain.md +++ b/docs/australis_start_sla-drain.md @@ -28,7 +28,6 @@ australis start sla-drain [space separated host list or use JSON flags] [flags] --json-file string JSON file to read list of agents from. --percentage float Percentage of instances that should be running to meet SLA. (default 80) --sla-limit duration Time limit after which SLA-Aware drain sheds SLA Awareness. (default 1h0m0s) - --timeout duration Time after which the monitor will stop polling and throw an error. (default 20m0s) ``` ### Options inherited from parent commands @@ -42,6 +41,7 @@ australis start sla-drain [space separated host list or use JSON flags] [flags] -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) @@ -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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_start_sla-drain_count.md b/docs/australis_start_sla-drain_count.md deleted file mode 100644 index 457d559..0000000 --- a/docs/australis_start_sla-drain_count.md +++ /dev/null @@ -1,45 +0,0 @@ -## australis start sla-drain count - -Place a list of space separated Mesos Agents into maintenance mode using the count SLA aware policy as a fallback. - -### Synopsis - -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. - -``` -australis start sla-drain count [space separated host list] [flags] -``` - -### Options - -``` - --count int Instances count that should be running to meet SLA. (default 5) - --duration RUNNING Minimum time duration a task needs to be RUNNING to be treated as active. (default 45s) - -h, --help help for count - --interval duration Interval at which to poll scheduler. (default 10s) - --sla-limit duration Time limit after which SLA-Aware drain sheds SLA Awareness. (default 1h0m0s) - --timeout duration Time after which the monitor will stop polling and throw an error. (default 20m0s) -``` - -### 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. - --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 start sla-drain](australis_start_sla-drain.md) - Place a list of space separated Mesos Agents into maintenance mode using SLA aware strategies. - -###### Auto generated by spf13/cobra on 22-Mar-2019 diff --git a/docs/australis_start_sla-drain_percentage.md b/docs/australis_start_sla-drain_percentage.md deleted file mode 100644 index d431564..0000000 --- a/docs/australis_start_sla-drain_percentage.md +++ /dev/null @@ -1,45 +0,0 @@ -## australis start sla-drain percentage - -Place a list of space separated Mesos Agents into maintenance mode using the percentage SLA aware policy as a fallback. - -### Synopsis - -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. - -``` -australis start sla-drain percentage [space separated host list] [flags] -``` - -### Options - -``` - --duration RUNNING Minimum time duration a task needs to be RUNNING to be treated as active. (default 45s) - -h, --help help for percentage - --interval duration Interval at which to poll scheduler. (default 10s) - --percent float Percentage of instances that should be running to meet SLA. (default 75) - --sla-limit duration Time limit after which SLA-Aware drain sheds SLA Awareness. (default 1h0m0s) - --timeout duration Time after which the monitor will stop polling and throw an error. (default 20m0s) -``` - -### 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. - --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 start sla-drain](australis_start_sla-drain.md) - Place a list of space separated Mesos Agents into maintenance mode using SLA aware strategies. - -###### Auto generated by spf13/cobra on 22-Mar-2019 diff --git a/docs/australis_start_update.md b/docs/australis_start_update.md index bc1f0e0..1bf29cb 100644 --- a/docs/australis_start_update.md +++ b/docs/australis_start_update.md @@ -16,7 +16,6 @@ australis start update [update config] [flags] ``` -h, --help help for update --interval duration Interval at which to poll scheduler. (default 5s) - --timeout duration Time after which the monitor will stop polling and throw an error. (default 10m0s) ``` ### Options inherited from parent commands @@ -30,6 +29,7 @@ australis start update [update config] [flags] -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) @@ -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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_stop.md b/docs/australis_stop.md index f7f8970..6ea3a5e 100644 --- a/docs/australis_stop.md +++ b/docs/australis_stop.md @@ -23,6 +23,7 @@ Stop a service or maintenance on a host (DRAIN). -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) @@ -34,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_stop_drain.md b/docs/australis_stop_drain.md index f9fb293..705e07c 100644 --- a/docs/australis_stop_drain.md +++ b/docs/australis_stop_drain.md @@ -15,7 +15,6 @@ australis stop drain [space separated host list] [flags] ``` -h, --help help for drain --interval duration Interval at which to poll scheduler. (default 5s) - --timeout duration Time after which the monitor will stop polling and throw an error. (default 1m0s) ``` ### Options inherited from parent commands @@ -29,6 +28,7 @@ australis stop drain [space separated host list] [flags] -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) @@ -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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 diff --git a/docs/australis_stop_update.md b/docs/australis_stop_update.md index 894925b..f597259 100644 --- a/docs/australis_stop_update.md +++ b/docs/australis_stop_update.md @@ -30,6 +30,7 @@ australis stop update [update ID] [flags] -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) @@ -39,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 7-May-2020 +###### Auto generated by spf13/cobra on 5-Nov-2020 From 2f051111928a9ebda2459ec405df4e2d395ea74e Mon Sep 17 00:00:00 2001 From: lenhattan86 Date: Tue, 17 Nov 2020 12:39:51 -0800 Subject: [PATCH 18/40] Fetch mesos leader through zookeeper (#19) Adds support for fetching current Mesos leader through Zookeeper --- cmd/fetch.go | 43 +++++++++++++++++++++++++++++++++++++++++++ cmd/root.go | 2 +- go.mod | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/cmd/fetch.go b/cmd/fetch.go index 0f778d2..c56cede 100644 --- a/cmd/fetch.go +++ b/cmd/fetch.go @@ -62,6 +62,23 @@ func init() { help(cmd, s) }) + /* Fetch mesos leader */ + mesosCmd.Flags().String("zkPath", "/mesos", "Zookeeper node path where mesos leader election happens") + + fetchCmd.AddCommand(mesosCmd) + + // Hijack help function to hide unnecessary global flags + mesosCmd.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) @@ -106,6 +123,17 @@ Pass Zookeeper nodes separated by a space as an argument to this command.`, Run: fetchLeader, } +var mesosCmd = &cobra.Command{ + Use: "mesos [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 leader given Zookeeper nodes. ", + Long: `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.`, + Run: fetchMesos, +} + var fetchJobsCmd = &cobra.Command{ Use: "jobs", Short: "Fetch a list of task Aurora running under a role.", @@ -218,6 +246,21 @@ func fetchLeader(cmd *cobra.Command, args []string) { fmt.Println(url) } +func fetchMesos(cmd *cobra.Command, args []string) { + if len(args) < 1 { + args = append(args, "localhost") + } + log.Infof("Fetching Mesos-master leader from %v \n", args) + + url, err := realis.MesosFromZKOpts(realis.ZKEndpoints(args...), realis.ZKPath(cmd.Flag("zkPath").Value.String())) + + if err != nil { + log.Fatalf("error: %+v\n", err) + } + + fmt.Println(url) +} + // TODO: Expand this to be able to filter by job name and environment. func fetchJobs(cmd *cobra.Command, args []string) { log.Infof("Fetching tasks under role: %s \n", *role) diff --git a/cmd/root.go b/cmd/root.go index 3b5889d..c15b064 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -47,7 +47,7 @@ var filename string var message = new(string) var updateID string var monitor bool -var timeout time.Duration // seconds +var timeout time.Duration var log = logrus.New() const australisVer = "v1.0.1" diff --git a/go.mod b/go.mod index a4ef81b..470ef98 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/aurora-scheduler/australis require ( - github.com/aurora-scheduler/gorealis/v2 v2.22.1 + github.com/aurora-scheduler/gorealis/v2 v2.22.2 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.6.0 github.com/spf13/cobra v1.0.0 From b21211552f61be84cd2185fa46172e67748b2964 Mon Sep 17 00:00:00 2001 From: Abdul Qadeer Date: Tue, 1 Dec 2020 09:49:03 -0800 Subject: [PATCH 19/40] Default to local Mesos agent if no ZK nodes are provided (#20) * Update go version * Fetches master flag from local mesos agent in order to get current leader from ZK if no arguments are provided. --- cmd/fetch.go | 105 ++++++++++++++++++++++++++++++++++++++++++++++----- go.mod | 5 +-- 2 files changed, 98 insertions(+), 12 deletions(-) diff --git a/cmd/fetch.go b/cmd/fetch.go index c56cede..5a6c754 100644 --- a/cmd/fetch.go +++ b/cmd/fetch.go @@ -15,7 +15,12 @@ package cmd import ( + "encoding/json" + "errors" "fmt" + "io/ioutil" + "net/http" + "strings" "github.com/aurora-scheduler/australis/internal" realis "github.com/aurora-scheduler/gorealis/v2" @@ -24,6 +29,19 @@ import ( "github.com/spf13/pflag" ) +const ( + localAgentStateURL = "http://127.0.0.1:5051/state" +) + +type mesosAgentState struct { + Flags mesosAgentFlags `json:"flags,omitempty"` +} + +type mesosAgentFlags struct { + Master string `json:"master,omitempty"` + hasMaster bool // indicates if the master flag contains direct Master's address +} + func init() { rootCmd.AddCommand(fetchCmd) @@ -62,8 +80,8 @@ func init() { help(cmd, s) }) - /* Fetch mesos leader */ - mesosCmd.Flags().String("zkPath", "/mesos", "Zookeeper node path where mesos leader election happens") + mesosLeaderCmd.Flags().String("zkPath", "/mesos", "Zookeeper node path where mesos leader election happens") + mesosCmd.AddCommand(mesosLeaderCmd) fetchCmd.AddCommand(mesosCmd) @@ -124,14 +142,21 @@ Pass Zookeeper nodes separated by a space as an argument to this command.`, } var mesosCmd = &cobra.Command{ - Use: "mesos [zkNode0, zkNode1, ...zkNodeN]", + Use: "mesos", + PreRun: setConfig, + Short: "Fetch information from Mesos.", +} + +var mesosLeaderCmd = &cobra.Command{ + Use: "leader [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 leader given Zookeeper nodes. ", + Short: "Fetch current Mesos-master leader given Zookeeper nodes.", Long: `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.`, - Run: fetchMesos, +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`, + Run: fetchMesosLeader, } var fetchJobsCmd = &cobra.Command{ @@ -246,11 +271,20 @@ func fetchLeader(cmd *cobra.Command, args []string) { fmt.Println(url) } -func fetchMesos(cmd *cobra.Command, args []string) { +func fetchMesosLeader(cmd *cobra.Command, args []string) { if len(args) < 1 { - args = append(args, "localhost") + mesosAgentFlags, err := fetchMasterFromAgent(localAgentStateURL) + if err != nil || mesosAgentFlags.Master == "" { + log.Debugf("unable to fetch Mesos leader via local Mesos agent: %v", err) + args = append(args, "localhost") + } else if mesosAgentFlags.hasMaster { + fmt.Println(mesosAgentFlags.Master) + return + } else { + args = append(args, strings.Split(mesosAgentFlags.Master, ",")...) + } } - log.Infof("Fetching Mesos-master leader from %v \n", args) + log.Infof("Fetching Mesos-master leader from Zookeeper node(s): %v \n", args) url, err := realis.MesosFromZKOpts(realis.ZKEndpoints(args...), realis.ZKPath(cmd.Flag("zkPath").Value.String())) @@ -261,6 +295,59 @@ func fetchMesos(cmd *cobra.Command, args []string) { fmt.Println(url) } +func fetchMasterFromAgent(url string) (mesosAgentFlags mesosAgentFlags, err error) { + resp, err := http.Get(url) + if err != nil { + return + } + if resp.StatusCode != 200 { + return + } + defer resp.Body.Close() + + state := &mesosAgentState{} + err = json.NewDecoder(resp.Body).Decode(state) + if err != nil { + return + } + mesosAgentFlags = state.Flags + err = updateMasterFlag(&mesosAgentFlags) + return +} + +/* + Master flag can be passed as one of : + host:port + zk://host1:port1,host2:port2,.../path + zk://username:password@host1:port1,host2:port2,.../path + file:///path/to/file + This function takes care of all the above cases and updates flags with parsed values +*/ +func updateMasterFlag(flags *mesosAgentFlags) error { + zkPathPrefix := "zk://" + filePathPrefix := "file://" + if strings.HasPrefix(flags.Master, zkPathPrefix) { + beginIndex := len(zkPathPrefix) + if strings.Contains(flags.Master, "@") { + beginIndex = strings.Index(flags.Master, "@") + 1 + } + flags.Master = flags.Master[beginIndex:strings.LastIndex(flags.Master, "/")] + } else if strings.HasPrefix(flags.Master, filePathPrefix) { + content, err := ioutil.ReadFile(flags.Master) + if err != nil { + return err + } + if strings.Contains(string(content), filePathPrefix) { + return errors.New("invalid master file content") + } + flags.Master = string(content) + return updateMasterFlag(flags) + } else { + flags.hasMaster = true + } + return nil +} + // TODO: Expand this to be able to filter by job name and environment. func fetchJobs(cmd *cobra.Command, args []string) { log.Infof("Fetching tasks under role: %s \n", *role) diff --git a/go.mod b/go.mod index 470ef98..5ad2f32 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/aurora-scheduler/australis +go 1.15 + require ( github.com/aurora-scheduler/gorealis/v2 v2.22.2 github.com/pkg/errors v0.9.1 @@ -7,11 +9,8 @@ require ( github.com/spf13/cobra v1.0.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.6.3 - github.com/stretchr/objx v0.1.1 // indirect github.com/stretchr/testify v1.5.0 gopkg.in/yaml.v2 v2.2.8 ) -go 1.14 - replace github.com/apache/thrift v0.13.0 => github.com/ridv/thrift v0.13.1 From 30a5136b24f4ff65c20a297cd0483382c2b330b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A1n=20Del=20Valle?= Date: Mon, 11 Jan 2021 17:53:01 -0800 Subject: [PATCH 20/40] Bumping up backported Thrift library. --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 5ad2f32..55efbf5 100644 --- a/go.mod +++ b/go.mod @@ -13,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.1 +replace github.com/apache/thrift v0.13.0 => github.com/ridv/thrift v0.13.2 From 154a4e1e872c10b589a21bc754e7533b21890584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A1n=20Del=20Valle?= Date: Mon, 11 Jan 2021 17:59:13 -0800 Subject: [PATCH 21/40] v1.0.2 Release --- CHANGELOG | 12 ++++++++++-- cmd/root.go | 2 +- debian/changelog | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a23d7a5..6fdede1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,14 @@ -0.1.2 +1.0.2 -* Unreleased +* Fixing broken Thrift dependency by bumping up backported version to thrift v0.13.2 + +1.0.1 + +* Added flag -m and --monitor that can be set in order to monitor a job creation or a job kill. By default monitor is set to true. + +1.0.0 + +* First stable release. 0.1.1 diff --git a/cmd/root.go b/cmd/root.go index c15b064..8e5532a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -50,7 +50,7 @@ var monitor bool var timeout time.Duration var log = logrus.New() -const australisVer = "v1.0.1" +const australisVer = "v1.0.2" var forceDrainTimeout time.Duration diff --git a/debian/changelog b/debian/changelog index 96a761f..e21244f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +australis (1.0.2) stable; urgency=medium + + * Fixing broken Thrift dependency by bumping up backported version to thrift v0.13.2 + + -- Renan Del Valle Mon, 11 Jan 2021 17:57:10 -0800 + australis (1.0.1) stable; urgency=medium * Added flag -m and --monitor that can be set in order to monitor a job creation or a job kill. By default monitor is set to true. From 13ae459d2a9a55b66a7555289f940f446f287671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A1n=20Del=20Valle?= Date: Mon, 11 Jan 2021 17:59:38 -0800 Subject: [PATCH 22/40] Bumps up current version. --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 6fdede1..3db8b6d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +1.0.3 (unreleased) + 1.0.2 * Fixing broken Thrift dependency by bumping up backported version to thrift v0.13.2 From 8ae23aad3046d843607abb2788184b6ec29f0446 Mon Sep 17 00:00:00 2001 From: lenhattan86 Date: Thu, 16 Sep 2021 18:36:13 -0700 Subject: [PATCH 23/40] Adds priority into job config (#23) --- internal/job.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/job.go b/internal/job.go index bdde546..1665080 100644 --- a/internal/job.go +++ b/internal/job.go @@ -71,6 +71,7 @@ type Job struct { URIs []URI `yaml:"uris"` Metadata map[string]string `yaml:"labels"` Service bool `yaml:"service"` + Priority int32 `yaml:"priority"` Thermos []ThermosProcess `yaml:",flow,omitempty"` Container *Container `yaml:"container,omitempty"` CronSchedule *string `yaml:"cronSchedule,omitempty"` @@ -88,6 +89,7 @@ func (j *Job) ToRealis() (*realis.AuroraJob, error) { RAM(j.RAM). Disk(j.Disk). IsService(j.Service). + Priority(j.Priority). InstanceCount(j.Instances). MaxFailure(j.MaxFailures) From 23e9c904d6ea411bca40839dafc2c1491d31eb06 Mon Sep 17 00:00:00 2001 From: lenhattan86 Date: Thu, 16 Sep 2021 18:36:42 -0700 Subject: [PATCH 24/40] Adds fetch quota command (#24) --- cmd/fetch.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/cmd/fetch.go b/cmd/fetch.go index 5a6c754..3d99fb0 100644 --- a/cmd/fetch.go +++ b/cmd/fetch.go @@ -103,6 +103,9 @@ func init() { // Fetch Status fetchCmd.AddCommand(fetchStatusCmd) + + // fetch quota + fetchCmd.AddCommand(fetchQuotaCmd) } var fetchCmd = &cobra.Command{ @@ -173,6 +176,13 @@ var fetchStatusCmd = &cobra.Command{ Run: fetchHostStatus, } +var fetchQuotaCmd = &cobra.Command{ + Use: "quota", + Short: "Fetch the quotas of given roles", + Long: `This command will print list of resource quotas with the aggregated resources for the given roles`, + Run: fetchQuota, +} + func fetchTasksConfig(cmd *cobra.Command, args []string) { log.Infof("Fetching job configuration for [%s/%s/%s] \n", *env, *role, *name) @@ -381,3 +391,28 @@ func fetchJobs(cmd *cobra.Command, args []string) { } } } + +//fetchQuota gets quotas for roles in args +func fetchQuota(cmd *cobra.Command, args []string) { + for _, role := range args { + log.Infof("Fetching quota for role: %s \n", role) + result, err := client.GetQuota(role) + if err != nil { + log.Fatalf("error: %+v\n", err) + } + + if toJson { + fmt.Println(internal.ToJSON(result)) + } else { + fmt.Printf(" Quota: %v\n", internal.ToJSON(result.Quota.GetResources())) + fmt.Printf(" Aggregated Resources: \n") + fmt.Printf(" ProdSharedConsumption: %v\n", internal.ToJSON(result.ProdSharedConsumption.GetResources())) + fmt.Printf(" NonProdSharedConsumption: %v\n", + internal.ToJSON(result.NonProdSharedConsumption.GetResources())) + fmt.Printf(" ProdDedicatedConsumption: %v\n", + internal.ToJSON(result.ProdDedicatedConsumption.GetResources())) + fmt.Printf(" NonProdDedicatedConsumption: %v\n", + internal.ToJSON(result.NonProdDedicatedConsumption.GetResources())) + } + } +} From c0c79997d0aba987f7a2229dacb1f0ec969c15f6 Mon Sep 17 00:00:00 2001 From: lenhattan86 Date: Tue, 5 Oct 2021 20:43:39 -0700 Subject: [PATCH 25/40] add tier and production --- go.mod | 4 ++-- internal/job.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 55efbf5..4fbb0ef 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/aurora-scheduler/australis go 1.15 require ( - github.com/aurora-scheduler/gorealis/v2 v2.22.2 + github.com/aurora-scheduler/gorealis/v2 v2.25.0 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.6.0 github.com/spf13/cobra v1.0.0 @@ -13,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 \ No newline at end of file diff --git a/internal/job.go b/internal/job.go index 1665080..181ea17 100644 --- a/internal/job.go +++ b/internal/job.go @@ -71,7 +71,9 @@ type Job struct { URIs []URI `yaml:"uris"` Metadata map[string]string `yaml:"labels"` Service bool `yaml:"service"` + Tier string `yaml:"tier,omitempty" default:"preemptible"` Priority int32 `yaml:"priority"` + Production bool `yaml:"production"` Thermos []ThermosProcess `yaml:",flow,omitempty"` Container *Container `yaml:"container,omitempty"` CronSchedule *string `yaml:"cronSchedule,omitempty"` @@ -89,7 +91,9 @@ func (j *Job) ToRealis() (*realis.AuroraJob, error) { RAM(j.RAM). Disk(j.Disk). IsService(j.Service). + Tier(j.Tier). Priority(j.Priority). + Production(j.Production). InstanceCount(j.Instances). MaxFailure(j.MaxFailures) From 0d5651028c872f189f8919ed6a2877794faff926 Mon Sep 17 00:00:00 2001 From: "Tan N. Le" Date: Wed, 20 Oct 2021 14:00:15 -0700 Subject: [PATCH 26/40] update gorealis version (#27) --- go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 4fbb0ef..8bfffbe 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/aurora-scheduler/australis go 1.15 require ( - github.com/aurora-scheduler/gorealis/v2 v2.25.0 + github.com/aurora-scheduler/gorealis/v2 v2.26.0 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.6.0 github.com/spf13/cobra v1.0.0 @@ -13,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 \ No newline at end of file +replace github.com/apache/thrift v0.13.0 => github.com/ridv/thrift v0.13.2 From 48db32c85865666c47f3ef9a374d5e052f716480 Mon Sep 17 00:00:00 2001 From: "Tan N. Le" Date: Wed, 20 Oct 2021 14:12:30 -0700 Subject: [PATCH 27/40] update CI to compile on PRs (#28) --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7696b1f..5b22bd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,12 @@ name: CI -on: [push] +on: + push: + branches: + - main + pull_request: + branches: + - main jobs: build: From 66bd6308ced0c24cf93d78aedaa3f2505ff37f24 Mon Sep 17 00:00:00 2001 From: lenhattan86 Date: Wed, 20 Oct 2021 14:46:53 -0700 Subject: [PATCH 28/40] update version 1.0.3 --- CHANGELOG | 9 ++++++++- debian/changelog | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 3db8b6d..3045432 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,11 @@ -1.0.3 (unreleased) +1.0.4 (unreleased) + +1.0.3 + +* update CI to compile on PRs +* Add tier and production in task config +* Add fetch quota command +* Add priority into job config 1.0.2 diff --git a/debian/changelog b/debian/changelog index e21244f..301b270 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +australis (1.0.3) stable; urgency=medium + + * Update CI to compile on PRs + * Add tier and production in task config + * Add fetch quota command + * Add priority into job config + + -- Nhat Tan Le Wed, 20 Oct 2021 14:24:10 -0700 + australis (1.0.2) stable; urgency=medium * Fixing broken Thrift dependency by bumping up backported version to thrift v0.13.2 From 14691698f6f58a76344f83a9d055155cce7edcc6 Mon Sep 17 00:00:00 2001 From: "Tan N. Le" Date: Tue, 2 Aug 2022 10:37:31 -0700 Subject: [PATCH 29/40] fetch capacity and simulate task fitting (#33) --- cmd/fetch.go | 60 ++++++++++++++++++++++++++++++++++++++++++ cmd/root.go | 3 ++- cmd/simulate.go | 61 +++++++++++++++++++++++++++++++++++++++++++ go.mod | 6 +++-- internal/job.go | 4 +++ internal/util.go | 20 ++++++++++++++ test/task_config.yaml | 20 ++++++++++++++ 7 files changed, 171 insertions(+), 3 deletions(-) create mode 100644 cmd/simulate.go create mode 100644 test/task_config.yaml diff --git a/cmd/fetch.go b/cmd/fetch.go index 3d99fb0..402b40c 100644 --- a/cmd/fetch.go +++ b/cmd/fetch.go @@ -106,6 +106,21 @@ func init() { // fetch quota fetchCmd.AddCommand(fetchQuotaCmd) + + // fetch capacity + fetchCmd.AddCommand(fetchAvailCapacityCmd) + + // Hijack help function to hide unnecessary global flags + fetchAvailCapacityCmd.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{ @@ -183,6 +198,14 @@ var fetchQuotaCmd = &cobra.Command{ Run: fetchQuota, } +var fetchAvailCapacityCmd = &cobra.Command{ + Use: "capacity", + PreRun: setConfig, + Short: "Fetch capacity report", + Long: `This command will show detailed capacity report of the cluster`, + Run: fetchAvailCapacity, +} + func fetchTasksConfig(cmd *cobra.Command, args []string) { log.Infof("Fetching job configuration for [%s/%s/%s] \n", *env, *role, *name) @@ -416,3 +439,40 @@ func fetchQuota(cmd *cobra.Command, args []string) { } } } + +//fetchAvailCapacity reports free capacity in details +func fetchAvailCapacity(cmd *cobra.Command, args []string) { + log.Infof("Fetching available capacity from %s/offers\n", client.GetSchedulerURL()) + + report, err := client.AvailOfferReport() + if err != nil { + log.Fatalf("error: %+v\n", err) + } + + // convert report to user-friendly structure + capacity := map[string]map[string]map[string]int64{} + for g, gv := range report { + if _, ok := capacity[g]; !ok { + capacity[g] = map[string]map[string]int64{} + } + + for r, rc := range gv { + if _, ok := capacity[g][r]; !ok { + capacity[g][r] = map[string]int64{} + } + + for v, c := range rc { + capacity[g][r][fmt.Sprint(v)] = c + } + } + } + + if toJson { + fmt.Println(internal.ToJSON(capacity)) + if err != nil { + log.Fatalf("error: %+v\n", err) + } + } else { + fmt.Println(capacity) + } +} diff --git a/cmd/root.go b/cmd/root.go index 8e5532a..598a9fb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -29,7 +29,8 @@ import ( var username, password, zkAddr, schedAddr string var env, role, name = new(string), new(string), new(string) -var ram, disk int64 +var dedicated string +var ram, disk, gpu, port int64 var cpu float64 var client *realis.Client var skipCertVerification bool diff --git a/cmd/simulate.go b/cmd/simulate.go new file mode 100644 index 0000000..a292693 --- /dev/null +++ b/cmd/simulate.go @@ -0,0 +1,61 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cmd + +import ( + "fmt" + + "github.com/aurora-scheduler/australis/internal" + "github.com/spf13/cobra" +) + +func init() { + rootCmd.AddCommand(simulateCmd) + + simulateCmd.AddCommand(fitCmd) +} + +var simulateCmd = &cobra.Command{ + Use: "simulate", + Short: "Simulate some work based on the current cluster condition, and return the output", +} + +var fitCmd = &cobra.Command{ + Use: "fit", + Short: "Compute how many tasks can we fit to a cluster", + Run: fit, + Args: cobra.RangeArgs(1, 2), +} + +func fit(cmd *cobra.Command, args []string) { + log.Infof("Compute how many tasks can be fit in the remaining cluster capacity") + + taskConfig, err := internal.UnmarshalTaskConfig(args[0]) + if err != nil { + log.Fatalln(err) + } + + offers, err := client.Offers() + if err != nil { + log.Fatal("error: %+v", err) + } + + numTasks, err := client.FitTasks(taskConfig, offers) + if err != nil { + log.Fatal("error: %+v", err) + } + + fmt.Println(numTasks) +} diff --git a/go.mod b/go.mod index 8bfffbe..a947918 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,9 @@ module github.com/aurora-scheduler/australis go 1.15 require ( - github.com/aurora-scheduler/gorealis/v2 v2.26.0 + 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/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.6.0 github.com/spf13/cobra v1.0.0 @@ -13,4 +15,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 \ No newline at end of file diff --git a/internal/job.go b/internal/job.go index 181ea17..2f5e09b 100644 --- a/internal/job.go +++ b/internal/job.go @@ -65,6 +65,8 @@ type Job struct { CPU float64 `yaml:"cpu"` RAM int64 `yaml:"ram"` Disk int64 `yaml:"disk"` + Port int64 `yaml:"port"` + GPU int64 `yaml:"gpu"` Executor Executor `yaml:"executor"` Instances int32 `yaml:"instances"` MaxFailures int32 `yaml:"maxFailures"` @@ -90,6 +92,8 @@ func (j *Job) ToRealis() (*realis.AuroraJob, error) { CPU(j.CPU). RAM(j.RAM). Disk(j.Disk). + AddPorts(int(j.Port)). + GPU(j.GPU). IsService(j.Service). Tier(j.Tier). Priority(j.Priority). diff --git a/internal/util.go b/internal/util.go index cc81cdb..dbf56be 100644 --- a/internal/util.go +++ b/internal/util.go @@ -118,6 +118,26 @@ func UnmarshalJob(filename string) (Job, error) { return job, nil } +func UnmarshalTaskConfig(filename string) (*aurora.TaskConfig, error) { + if jobsFile, err := os.Open(filename); err != nil { + return nil, errors.Wrap(err, "unable to read the task config file") + } else { + job := Job{} + + if err := yaml.NewDecoder(jobsFile).Decode(&job); err != nil { + return nil, errors.Wrap(err, "unable to parse task config file") + } + + if auroraJob, err := job.ToRealis(); err != nil { + return nil, errors.Wrap(err, "unable to parse task config file") + } else { + return auroraJob.JobConfig().TaskConfig, nil + } + } + + return nil, nil +} + func UnmarshalUpdate(filename string) (UpdateJob, error) { updateJob := UpdateJob{} diff --git a/test/task_config.yaml b/test/task_config.yaml new file mode 100644 index 0000000..addb8c1 --- /dev/null +++ b/test/task_config.yaml @@ -0,0 +1,20 @@ +environment: "prod" +role: "vagrant" +name: "hello_world" +cpu: 0.09 +ram: 64 +disk: 128 +valueConstraints: + - name: "dedicated" + values: + - "vagrant/bar" +limitConstraints: + - name: "host" + limit: 1 + - name: "zone" + limit: 2 +thermos: + - name: "bootstrap" + cmd: "echo bootstrapping" + - name: "hello_gorealis" + cmd: "while true; do echo hello world from gorealis; sleep 10; done" From 47644c13c2bdbea43a19856d57e436de7b953cf0 Mon Sep 17 00:00:00 2001 From: nhatle Date: Tue, 2 Aug 2022 10:48:45 -0700 Subject: [PATCH 30/40] release 1.0.4 --- CHANGELOG | 7 ++++++- cmd/root.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3045432..0c7d927 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,9 @@ -1.0.4 (unreleased) +1.0.5 (unreleased) + +1.0.4 + +* fetch free capacity +* simulate task fitting - compute how many tasks can be fit in the remaining capacity 1.0.3 diff --git a/cmd/root.go b/cmd/root.go index 598a9fb..d2d0d71 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -51,7 +51,7 @@ var monitor bool var timeout time.Duration var log = logrus.New() -const australisVer = "v1.0.2" +const australisVer = "v1.0.4" var forceDrainTimeout time.Duration From 0a3357e571bbe1e0774b2ba8d1a80c3ec791e134 Mon Sep 17 00:00:00 2001 From: nhatle Date: Tue, 2 Aug 2022 16:21:11 -0700 Subject: [PATCH 31/40] relase v1.0.4 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 301b270..9779d6f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +australis (1.0.4) stable; urgency=medium + + * fetch free capacity + * simulate task fitting - compute how many tasks can be fit in the remaining capacity + + -- Nhat Tan Le Tue, 2 Aug 2022 16:19:24 -0700 + australis (1.0.3) stable; urgency=medium * Update CI to compile on PRs From 2c703978bb168f034cfbad757716d00f2725fcb3 Mon Sep 17 00:00:00 2001 From: lawwong1 <105893156+lawwong1@users.noreply.github.com> Date: Mon, 15 Aug 2022 13:35:04 -0700 Subject: [PATCH 32/40] given a task status, list all tasks that have that status in the cluster (#35) --- cmd/fetch.go | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++ cmd/root.go | 1 + 2 files changed, 100 insertions(+) diff --git a/cmd/fetch.go b/cmd/fetch.go index 402b40c..242a629 100644 --- a/cmd/fetch.go +++ b/cmd/fetch.go @@ -121,6 +121,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{ @@ -206,6 +227,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) @@ -476,3 +504,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 +} diff --git a/cmd/root.go b/cmd/root.go index d2d0d71..cc72ac3 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -50,6 +50,7 @@ var updateID string var monitor bool var timeout time.Duration var log = logrus.New() +var taskStatus = new(string) const australisVer = "v1.0.4" From b0743636a18ead08b001b157cd5993b40f2bb1a1 Mon Sep 17 00:00:00 2001 From: ananaysingh <54039499+ananaysingh@users.noreply.github.com> Date: Thu, 18 Aug 2022 22:57:57 +0530 Subject: [PATCH 33/40] KillTask API (#37) --- cmd/kill.go | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ cmd/root.go | 1 + internal/job.go | 5 +++- 3 files changed, 83 insertions(+), 1 deletion(-) diff --git a/cmd/kill.go b/cmd/kill.go index 88d1d9f..47140ba 100644 --- a/cmd/kill.go +++ b/cmd/kill.go @@ -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("instance") } 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,48 @@ 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) + + //Check that instance number is passed + if instances == nil { + log.Fatalln("Instance number not found. Please pass a valid instance number. If you want to pass multiple instances, please pass them as comma separated integer values") + } + + /* + * 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") + } + } +} diff --git a/cmd/root.go b/cmd/root.go index cc72ac3..a2084e9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -51,6 +51,7 @@ var monitor bool var timeout time.Duration var log = logrus.New() var taskStatus = new(string) +var instances = new(string) const australisVer = "v1.0.4" diff --git a/internal/job.go b/internal/job.go index 2f5e09b..b2ffc8b 100644 --- a/internal/job.go +++ b/internal/job.go @@ -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) } From a19c7e1fb5a0958477ab6c944c7521652ed5b713 Mon Sep 17 00:00:00 2001 From: lawwong1 <105893156+lawwong1@users.noreply.github.com> Date: Wed, 24 Aug 2022 10:25:49 -0700 Subject: [PATCH 34/40] API to get master nodes for mesos and aurora (#38) --- cmd/fetch.go | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++ go.mod | 6 +-- 2 files changed, 110 insertions(+), 4 deletions(-) diff --git a/cmd/fetch.go b/cmd/fetch.go index 242a629..fbdc309 100644 --- a/cmd/fetch.go +++ b/cmd/fetch.go @@ -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) @@ -180,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, @@ -198,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.", @@ -356,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 { diff --git a/go.mod b/go.mod index a947918..0fcf130 100644 --- a/go.mod +++ b/go.mod @@ -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 \ No newline at end of file +replace github.com/apache/thrift v0.13.0 => github.com/ridv/thrift v0.13.2 From 3d49194ccd934757a52736666057e8a75e17343d Mon Sep 17 00:00:00 2001 From: nhatle Date: Wed, 31 Aug 2022 13:44:08 -0700 Subject: [PATCH 35/40] release 1.0.5 --- CHANGELOG | 7 ++++++- cmd/root.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0c7d927..2c36ee7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/cmd/root.go b/cmd/root.go index a2084e9..722358b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -53,7 +53,7 @@ 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 From b08640f26ad5821a861aa1dab68d87988abe0b31 Mon Sep 17 00:00:00 2001 From: nhatle Date: Wed, 31 Aug 2022 15:04:55 -0700 Subject: [PATCH 36/40] fix duplicated flags -i --- cmd/kill.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/kill.go b/cmd/kill.go index 47140ba..06ed419 100644 --- a/cmd/kill.go +++ b/cmd/kill.go @@ -43,7 +43,7 @@ func init() { 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().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") @@ -65,13 +65,13 @@ var killJobCmd = &cobra.Command{ /* * 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 +* 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" +* 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" +* 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{ From 8ed6f5a7737543c6134f97bf9df313199c186b91 Mon Sep 17 00:00:00 2001 From: nhatle Date: Wed, 31 Aug 2022 15:05:08 -0700 Subject: [PATCH 37/40] release 1.0.5 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9779d6f..07a8161 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +australis (1.0.5) stable; urgency=medium + + * kill tasks + * fetch all aurora & mesos master nodes + + -- Nhat Tan Le Wed, 31 Aug 2022 15:03:24 -0700 + australis (1.0.4) stable; urgency=medium * fetch free capacity From 7b298f7a357bae7f466096e452be5f78e8db5405 Mon Sep 17 00:00:00 2001 From: lawwong1 <105893156+lawwong1@users.noreply.github.com> Date: Fri, 9 Sep 2022 09:07:39 -0700 Subject: [PATCH 38/40] Generate Docs for Australis (#41) Co-authored-by: Lawrence Wong --- docs/australis.md | 3 +- docs/australis_create.md | 2 +- docs/australis_fetch.md | 7 +++- docs/australis_fetch_capacity.md | 40 +++++++++++++++++++++++ docs/australis_fetch_jobs.md | 2 +- docs/australis_fetch_leader.md | 2 +- docs/australis_fetch_master.md | 42 ++++++++++++++++++++++++ docs/australis_fetch_mesos.md | 38 ++++++++++++++++++++++ docs/australis_fetch_mesos_leader.md | 43 ++++++++++++++++++++++++ docs/australis_fetch_mesos_master.md | 43 ++++++++++++++++++++++++ docs/australis_fetch_quota.md | 40 +++++++++++++++++++++++ docs/australis_fetch_status.md | 2 +- docs/australis_fetch_task.md | 2 +- docs/australis_fetch_task_config.md | 2 +- docs/australis_fetch_task_status.md | 2 +- docs/australis_fetch_tasks.md | 44 +++++++++++++++++++++++++ docs/australis_force.md | 2 +- docs/australis_force_backup.md | 2 +- docs/australis_force_recon.md | 2 +- docs/australis_force_recon_explicit.md | 2 +- docs/australis_force_recon_implicit.md | 2 +- docs/australis_force_snapshot.md | 2 +- docs/australis_kill.md | 3 +- docs/australis_kill_job.md | 2 +- docs/australis_kill_tasks.md | 45 ++++++++++++++++++++++++++ docs/australis_monitor.md | 2 +- docs/australis_monitor_hosts.md | 2 +- docs/australis_pulse.md | 2 +- docs/australis_restart.md | 2 +- docs/australis_restart_job.md | 2 +- docs/australis_resume.md | 2 +- docs/australis_rollback.md | 2 +- docs/australis_rollback_update.md | 2 +- docs/australis_schedule.md | 2 +- docs/australis_set.md | 2 +- docs/australis_set_quota.md | 2 +- docs/australis_simulate.md | 37 +++++++++++++++++++++ docs/australis_simulate_fit.md | 40 +++++++++++++++++++++++ docs/australis_start.md | 2 +- docs/australis_start_drain.md | 2 +- docs/australis_start_maintenance.md | 2 +- docs/australis_start_sla-drain.md | 2 +- docs/australis_start_update.md | 2 +- docs/australis_stop.md | 2 +- docs/australis_stop_drain.md | 2 +- docs/australis_stop_update.md | 2 +- 46 files changed, 455 insertions(+), 36 deletions(-) create mode 100644 docs/australis_fetch_capacity.md create mode 100644 docs/australis_fetch_master.md create mode 100644 docs/australis_fetch_mesos.md create mode 100644 docs/australis_fetch_mesos_leader.md create mode 100644 docs/australis_fetch_mesos_master.md create mode 100644 docs/australis_fetch_quota.md create mode 100644 docs/australis_fetch_tasks.md create mode 100644 docs/australis_kill_tasks.md create mode 100644 docs/australis_simulate.md create mode 100644 docs/australis_simulate_fit.md diff --git a/docs/australis.md b/docs/australis.md index 352c6f6..4c257ec 100644 --- a/docs/australis.md +++ b/docs/australis.md @@ -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 diff --git a/docs/australis_create.md b/docs/australis_create.md index 8069bc2..dc01c77 100644 --- a/docs/australis_create.md +++ b/docs/australis_create.md @@ -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 diff --git a/docs/australis_fetch.md b/docs/australis_fetch.md index 2f365c8..8853103 100644 --- a/docs/australis_fetch.md +++ b/docs/australis_fetch.md @@ -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 diff --git a/docs/australis_fetch_capacity.md b/docs/australis_fetch_capacity.md new file mode 100644 index 0000000..d26f37c --- /dev/null +++ b/docs/australis_fetch_capacity.md @@ -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 diff --git a/docs/australis_fetch_jobs.md b/docs/australis_fetch_jobs.md index 2f2dc6c..a150ae4 100644 --- a/docs/australis_fetch_jobs.md +++ b/docs/australis_fetch_jobs.md @@ -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 diff --git a/docs/australis_fetch_leader.md b/docs/australis_fetch_leader.md index dd99c47..0a326b8 100644 --- a/docs/australis_fetch_leader.md +++ b/docs/australis_fetch_leader.md @@ -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 diff --git a/docs/australis_fetch_master.md b/docs/australis_fetch_master.md new file mode 100644 index 0000000..9f8da1c --- /dev/null +++ b/docs/australis_fetch_master.md @@ -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 diff --git a/docs/australis_fetch_mesos.md b/docs/australis_fetch_mesos.md new file mode 100644 index 0000000..3926905 --- /dev/null +++ b/docs/australis_fetch_mesos.md @@ -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 diff --git a/docs/australis_fetch_mesos_leader.md b/docs/australis_fetch_mesos_leader.md new file mode 100644 index 0000000..c6557b9 --- /dev/null +++ b/docs/australis_fetch_mesos_leader.md @@ -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 diff --git a/docs/australis_fetch_mesos_master.md b/docs/australis_fetch_mesos_master.md new file mode 100644 index 0000000..7f35c9a --- /dev/null +++ b/docs/australis_fetch_mesos_master.md @@ -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 diff --git a/docs/australis_fetch_quota.md b/docs/australis_fetch_quota.md new file mode 100644 index 0000000..d3583ff --- /dev/null +++ b/docs/australis_fetch_quota.md @@ -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 diff --git a/docs/australis_fetch_status.md b/docs/australis_fetch_status.md index 373ceaa..a80cacf 100644 --- a/docs/australis_fetch_status.md +++ b/docs/australis_fetch_status.md @@ -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 diff --git a/docs/australis_fetch_task.md b/docs/australis_fetch_task.md index 70fff8e..b6ce7c2 100644 --- a/docs/australis_fetch_task.md +++ b/docs/australis_fetch_task.md @@ -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 diff --git a/docs/australis_fetch_task_config.md b/docs/australis_fetch_task_config.md index 6dae394..23b1005 100644 --- a/docs/australis_fetch_task_config.md +++ b/docs/australis_fetch_task_config.md @@ -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 diff --git a/docs/australis_fetch_task_status.md b/docs/australis_fetch_task_status.md index 5cbdf79..bd44edf 100644 --- a/docs/australis_fetch_task_status.md +++ b/docs/australis_fetch_task_status.md @@ -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 diff --git a/docs/australis_fetch_tasks.md b/docs/australis_fetch_tasks.md new file mode 100644 index 0000000..71dd4a8 --- /dev/null +++ b/docs/australis_fetch_tasks.md @@ -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 diff --git a/docs/australis_force.md b/docs/australis_force.md index 6aaccb3..420123d 100644 --- a/docs/australis_force.md +++ b/docs/australis_force.md @@ -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 diff --git a/docs/australis_force_backup.md b/docs/australis_force_backup.md index 1fd0a74..81ce196 100644 --- a/docs/australis_force_backup.md +++ b/docs/australis_force_backup.md @@ -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 diff --git a/docs/australis_force_recon.md b/docs/australis_force_recon.md index 9907fed..b470706 100644 --- a/docs/australis_force_recon.md +++ b/docs/australis_force_recon.md @@ -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 diff --git a/docs/australis_force_recon_explicit.md b/docs/australis_force_recon_explicit.md index 113316c..cbc1be8 100644 --- a/docs/australis_force_recon_explicit.md +++ b/docs/australis_force_recon_explicit.md @@ -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 diff --git a/docs/australis_force_recon_implicit.md b/docs/australis_force_recon_implicit.md index 932f390..e5b1159 100644 --- a/docs/australis_force_recon_implicit.md +++ b/docs/australis_force_recon_implicit.md @@ -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 diff --git a/docs/australis_force_snapshot.md b/docs/australis_force_snapshot.md index f6207a3..1e89739 100644 --- a/docs/australis_force_snapshot.md +++ b/docs/australis_force_snapshot.md @@ -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 diff --git a/docs/australis_kill.md b/docs/australis_kill.md index 69403b7..0398dac 100644 --- a/docs/australis_kill.md +++ b/docs/australis_kill.md @@ -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 diff --git a/docs/australis_kill_job.md b/docs/australis_kill_job.md index 56446f3..4ca1e6e 100644 --- a/docs/australis_kill_job.md +++ b/docs/australis_kill_job.md @@ -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 diff --git a/docs/australis_kill_tasks.md b/docs/australis_kill_tasks.md new file mode 100644 index 0000000..274ad4d --- /dev/null +++ b/docs/australis_kill_tasks.md @@ -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 diff --git a/docs/australis_monitor.md b/docs/australis_monitor.md index 59ba91a..50fea35 100644 --- a/docs/australis_monitor.md +++ b/docs/australis_monitor.md @@ -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 diff --git a/docs/australis_monitor_hosts.md b/docs/australis_monitor_hosts.md index 508fb68..8264253 100644 --- a/docs/australis_monitor_hosts.md +++ b/docs/australis_monitor_hosts.md @@ -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 diff --git a/docs/australis_pulse.md b/docs/australis_pulse.md index 904e253..a152e9b 100644 --- a/docs/australis_pulse.md +++ b/docs/australis_pulse.md @@ -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 diff --git a/docs/australis_restart.md b/docs/australis_restart.md index 6b1aa9f..81ea511 100644 --- a/docs/australis_restart.md +++ b/docs/australis_restart.md @@ -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 diff --git a/docs/australis_restart_job.md b/docs/australis_restart_job.md index 219c3c2..83be678 100644 --- a/docs/australis_restart_job.md +++ b/docs/australis_restart_job.md @@ -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 diff --git a/docs/australis_resume.md b/docs/australis_resume.md index cd9b899..8a63327 100644 --- a/docs/australis_resume.md +++ b/docs/australis_resume.md @@ -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 diff --git a/docs/australis_rollback.md b/docs/australis_rollback.md index 3c6fc7d..e6a2da9 100644 --- a/docs/australis_rollback.md +++ b/docs/australis_rollback.md @@ -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 diff --git a/docs/australis_rollback_update.md b/docs/australis_rollback_update.md index 5e45946..e4dedee 100644 --- a/docs/australis_rollback_update.md +++ b/docs/australis_rollback_update.md @@ -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 diff --git a/docs/australis_schedule.md b/docs/australis_schedule.md index ff97b70..7e139ba 100644 --- a/docs/australis_schedule.md +++ b/docs/australis_schedule.md @@ -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 diff --git a/docs/australis_set.md b/docs/australis_set.md index 6973c69..f462012 100644 --- a/docs/australis_set.md +++ b/docs/australis_set.md @@ -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 diff --git a/docs/australis_set_quota.md b/docs/australis_set_quota.md index 3e29bb3..cf28a6b 100644 --- a/docs/australis_set_quota.md +++ b/docs/australis_set_quota.md @@ -37,4 +37,4 @@ australis set quota cpu: ram: disk: [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 diff --git a/docs/australis_simulate.md b/docs/australis_simulate.md new file mode 100644 index 0000000..33de188 --- /dev/null +++ b/docs/australis_simulate.md @@ -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 diff --git a/docs/australis_simulate_fit.md b/docs/australis_simulate_fit.md new file mode 100644 index 0000000..384c96d --- /dev/null +++ b/docs/australis_simulate_fit.md @@ -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 diff --git a/docs/australis_start.md b/docs/australis_start.md index 9a8a8dd..1ca4b1a 100644 --- a/docs/australis_start.md +++ b/docs/australis_start.md @@ -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 diff --git a/docs/australis_start_drain.md b/docs/australis_start_drain.md index 2073cd4..bd16f94 100644 --- a/docs/australis_start_drain.md +++ b/docs/australis_start_drain.md @@ -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 diff --git a/docs/australis_start_maintenance.md b/docs/australis_start_maintenance.md index 51db1de..78b88da 100644 --- a/docs/australis_start_maintenance.md +++ b/docs/australis_start_maintenance.md @@ -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 diff --git a/docs/australis_start_sla-drain.md b/docs/australis_start_sla-drain.md index 3c0263d..cafc961 100644 --- a/docs/australis_start_sla-drain.md +++ b/docs/australis_start_sla-drain.md @@ -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 diff --git a/docs/australis_start_update.md b/docs/australis_start_update.md index 1bf29cb..4bd89f0 100644 --- a/docs/australis_start_update.md +++ b/docs/australis_start_update.md @@ -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 diff --git a/docs/australis_stop.md b/docs/australis_stop.md index 6ea3a5e..eb0c92f 100644 --- a/docs/australis_stop.md +++ b/docs/australis_stop.md @@ -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 diff --git a/docs/australis_stop_drain.md b/docs/australis_stop_drain.md index 705e07c..9a4ea99 100644 --- a/docs/australis_stop_drain.md +++ b/docs/australis_stop_drain.md @@ -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 diff --git a/docs/australis_stop_update.md b/docs/australis_stop_update.md index f597259..faa7be9 100644 --- a/docs/australis_stop_update.md +++ b/docs/australis_stop_update.md @@ -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 From 589e337e283c143cff1a49f48063255564954d17 Mon Sep 17 00:00:00 2001 From: ananaysingh <54039499+ananaysingh@users.noreply.github.com> Date: Thu, 15 Sep 2022 23:07:02 +0530 Subject: [PATCH 39/40] 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 --- cmd/kill.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/kill.go b/cmd/kill.go index 06ed419..98e4401 100644 --- a/cmd/kill.go +++ b/cmd/kill.go @@ -48,7 +48,7 @@ func init() { killTasksCmd.MarkFlagRequired("environment") killTasksCmd.MarkFlagRequired("role") killTasksCmd.MarkFlagRequired("name") - killTasksCmd.MarkFlagRequired("instance") + killTasksCmd.MarkFlagRequired("instances") } var killCmd = &cobra.Command{ @@ -107,11 +107,6 @@ func killTasks(cmd *cobra.Command, args []string) { Role(*role). Name(*name) - //Check that instance number is passed - if instances == nil { - log.Fatalln("Instance number not found. Please pass a valid instance number. If you want to pass multiple instances, please pass them as comma separated integer values") - } - /* * 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. From 464db4e5ccc3d06bec537b4bd28cb905fd302f01 Mon Sep 17 00:00:00 2001 From: lawwong1 <105893156+lawwong1@users.noreply.github.com> Date: Thu, 22 Sep 2022 20:05:19 -0700 Subject: [PATCH 40/40] Implement Australis api to restart a task (#43) --- cmd/restart.go | 63 +++++++++++++++++++++++++++++++++ docs/australis_restart_tasks.md | 45 +++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 docs/australis_restart_tasks.md diff --git a/cmd/restart.go b/cmd/restart.go index d90d5fd..c207ffb 100644 --- a/cmd/restart.go +++ b/cmd/restart.go @@ -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()) + } + } + +} diff --git a/docs/australis_restart_tasks.md b/docs/australis_restart_tasks.md new file mode 100644 index 0000000..1f33c79 --- /dev/null +++ b/docs/australis_restart_tasks.md @@ -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