Compare commits

...

106 commits
v0.0.5 ... main

Author SHA1 Message Date
lawwong1
464db4e5cc
Implement Australis api to restart a task (#43) 2022-09-22 20:05:19 -07:00
ananaysingh
589e337e28
Updated kill.go (#42)
in killTask function, null check removed for instances, as it is a mandatory parameter in the killTask command. Also made changes to improve language consistency
2022-09-15 10:37:02 -07:00
lawwong1
7b298f7a35
Generate Docs for Australis (#41)
Co-authored-by: Lawrence Wong <lawwong@paypal.com>
2022-09-09 09:07:39 -07:00
nhatle
8ed6f5a773 release 1.0.5 2022-08-31 15:05:08 -07:00
nhatle
b08640f26a fix duplicated flags -i 2022-08-31 15:04:55 -07:00
nhatle
3d49194ccd release 1.0.5 2022-08-31 13:44:08 -07:00
lawwong1
a19c7e1fb5
API to get master nodes for mesos and aurora (#38) 2022-08-24 10:25:49 -07:00
ananaysingh
b0743636a1
KillTask API (#37) 2022-08-18 10:27:57 -07:00
lawwong1
2c703978bb
given a task status, list all tasks that have that status in the cluster (#35) 2022-08-15 13:35:04 -07:00
nhatle
0a3357e571 relase v1.0.4 2022-08-02 16:21:11 -07:00
nhatle
47644c13c2 release 1.0.4 2022-08-02 10:48:45 -07:00
Tan N. Le
14691698f6
fetch capacity and simulate task fitting (#33) 2022-08-02 10:37:31 -07:00
lenhattan86
66bd6308ce update version 1.0.3 2021-10-20 14:46:53 -07:00
Tan N. Le
48db32c858
update CI to compile on PRs (#28) 2021-10-20 14:12:30 -07:00
Tan N. Le
0d5651028c
update gorealis version (#27) 2021-10-20 14:00:15 -07:00
lenhattan86
7bcf6d3f68
Merge pull request #25 from lenhattan86/add_more_in_TaskConfig
Add tier and production in task config
2021-10-06 19:21:21 -07:00
lenhattan86
c0c79997d0 add tier and production 2021-10-05 20:43:39 -07:00
lenhattan86
c6adde03af
Merge branch 'aurora-scheduler:main' into master 2021-10-05 17:18:47 -07:00
lenhattan86
23e9c904d6
Adds fetch quota command (#24) 2021-09-16 18:36:42 -07:00
lenhattan86
8ae23aad30
Adds priority into job config (#23) 2021-09-16 18:36:13 -07:00
lenhattan86
aa7e052d7a
Merge branch 'aurora-scheduler:main' into master 2021-09-07 12:31:05 -07:00
Renán Del Valle
13ae459d2a
Bumps up current version. 2021-01-11 17:59:38 -08:00
Renán Del Valle
154a4e1e87
v1.0.2 Release 2021-01-11 17:59:13 -08:00
Renán Del Valle
30a5136b24
Bumping up backported Thrift library. 2021-01-11 17:53:01 -08:00
lenhattan86
438b5360c1
Merge pull request #2 from aurora-scheduler/main
fetch mesos leader.
2020-12-09 15:04:10 -08:00
Abdul Qadeer
b21211552f
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.
2020-12-01 09:49:03 -08:00
lenhattan86
2f05111192
Fetch mesos leader through zookeeper (#19)
Adds support for fetching current Mesos leader through Zookeeper
2020-11-17 12:39:51 -08:00
lenhattan86
8ebf66426a
Merge pull request #1 from aurora-scheduler/main
pull from the upstream
2020-11-13 10:48:05 -08:00
Renán I. Del Valle
be6c458f23
Documentation update (#17)
* Updates documentation automatically generated by Cobra. Deletes some old, outdated documentation.
2020-11-05 15:46:07 -08:00
Renán I. Del Valle
9fa6edaa3e
Adds support for creating jobs with limit constraints and value constraints. (#16)
* Adds support for creating jobs with limit constraints and value constraints.
2020-11-04 11:46:53 -08:00
Renan DelValle
464ef72e6b
Changing style of setting up github actions env due to the deprecation of the old way. 2020-10-14 20:53:32 -07:00
Renan DelValle
cea39ddd88
Fixing all files to conform with goimports. 2020-10-14 20:46:50 -07:00
Renan DelValle
99af97736c
Fixing goimports call 2020-10-14 20:46:32 -07:00
Renan DelValle
7e7c887231
Bumping up go setup in CI to v2. 2020-10-14 20:32:34 -07:00
Renan DelValle
a7750c5c98
Adding simple goimports check and build check CI. 2020-10-14 20:27:25 -07:00
Renan DelValle
7967188513
Fixing issue where duration variable was accidentally multiplied by seconds again. 2020-10-14 20:17:43 -07:00
lenhattan86
bb370151e6
Add gorealis timeout flag (#14)
Flag was added to control gorealis timeout
2020-10-08 09:01:56 -07:00
Renan DelValle
2a76e3e2b4
1.0.1 release 2020-09-30 16:47:53 -07:00
Renan DelValle
d5d19cf448
Changing default value of monitor to true. 2020-09-30 16:46:14 -07:00
Renan DelValle
deaddd2953
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 2020-09-30 16:34:02 -07:00
lenhattan86
5efbbce6c7
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.
2020-09-30 16:32:53 -07:00
Renan DelValle
82fe22e013
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. 2020-05-07 20:19:26 -07:00
Renan DelValle
090fdf1715
Removing update settings from cron example as they're not needed. 2020-05-07 16:46:05 -07:00
Renan DelValle
13fbbce816
Adding rudimentary test for unmarshaling cron job. 2020-05-07 16:37:19 -07:00
Renan DelValle
d06530d0ca
Adding sample update job. 2020-05-07 16:31:32 -07:00
Renan DelValle
2df6672acc
Adding schedule command to schedule cron jobs.
Adding example of a cron job.

Removing functions since they've been moved elsewhere.
2020-05-07 16:28:55 -07:00
Renan DelValle
620586fa73
Upgrading documentation automatically generated by cobra. 2020-05-07 15:44:27 -07:00
Renán I. Del Valle
4806936c71
Adding ability to start an update (#12)
* Adding ability to start an update.

* Refactoring Job parsing code to be re-usable.
2020-05-07 15:40:22 -07:00
Renan DelValle
d7db155d88
Refactoring project to be more similar to other go project. 2020-05-07 10:09:45 -07:00
Renan DelValle
bbccabcd27
Moving internal types to the right location. 2020-05-06 18:30:22 -07:00
Renán I. Del Valle
e3e7bc1110
Upgrading dependencies to the latest available as well as bumping up go version to 1.14. (#11) 2020-05-05 23:17:40 -07:00
Renán I. Del Valle
b068369e86
Removing vendored files as they are now cached by go proxy. (#10)
We no longer need vendoring as packages are cached in case they go missing or move from their current location.
2020-05-05 23:09:37 -07:00
Renan DelValle
ca2fab72fd
Increasing version to 0.1.2 unreleased. 2020-02-19 12:40:05 -08:00
Renan DelValle
6603e24ec8
Releasing version 0.1.1. 2020-02-19 12:36:11 -08:00
Renán I. Del Valle
5f510b74ea
Changing dependencies to point to aurora-scheduler organization (#9)
* Removing support for dep as we should now only be building with go1.13+ and mod.

* Ignoring go.sum being created. Use the database instead.

* Upgrading dependencies to their latest versions.

* Replacing thrift dependency temporarily with a patched thrift dependency while we wait for 0.14.0 to be released.

* Change location of gorealis to point to auora-scheduler repository.

* Update .gitignore to contain DS_Store.

* Adding changelog.

* Putting unreleased back into the changelog as this isn't a release PR.
2020-02-19 12:18:50 -08:00
Renan DelValle
08c68935e7
Changing version to unreleased 0.1.1 2020-02-10 12:05:32 -08:00
Renan DelValle
702916acc7
0.1.0 release. 2020-02-10 11:59:35 -08:00
Renan I. Del Valle
f94a055b47
JSON support for taking in host list (#8)
* Bumping up the version.

* Adding flags to take in JSON from the command line.

* go.sum no longer strictly necessary since go1.13

* Adding support for reading JSON list of hosts to drain from STDIN or from a file.

* Adding changes to changelogs
2020-02-07 18:41:59 -08:00
Renan DelValle
d63c719cef
Bumping up version to unreleased 0.0.10 2020-01-29 16:18:25 -08:00
Renan DelValle
19beafe6f1
Releasing 0.0.9 2020-01-29 16:15:13 -08:00
Renan I. Del Valle
fa0179292a
Refactoring start sla-drain (#7)
Changing sla-drain command to be less cumbersome. sla-drain command now takes --count or --percentage and they are mutually exclusive.
2020-01-29 16:12:53 -08:00
Renan DelValle
b65ac55c1c
Adding the ability to pulse a job update. 2019-12-05 17:50:50 -08:00
Renan DelValle
68cea84182
Adding the ability to resume a paused update. 2019-10-23 12:59:15 -07:00
Renan DelValle
11097ce96d
Adding new create support to CHANEGELOG. 2019-07-24 16:52:59 -07:00
Renan DelValle
63d7c4c1aa
Adding support for creating jobs which use executorless docker containers.Note, that this feature must be enabled on the aurora-scheduler manually. 2019-07-24 16:43:00 -07:00
Renan DelValle
125025157b
Hides a perviously exported struct. Shortens a line that was too long. 2019-06-28 10:21:51 -07:00
Renan DelValle
cbac86cb20
Adding job restart command. 2019-06-28 10:20:56 -07:00
Renan DelValle
54b3295605
Updating go version that deb package is generated with to 1.12.6. 2019-06-28 10:20:30 -07:00
Renan DelValle
6e6934a3d3
Adding Apache v2 license. 2019-03-25 17:36:24 -07:00
Renan DelValle
178e12bcc9
Bumping up version for continuing development. 2019-03-25 17:25:21 -07:00
Renan DelValle
d9445888ac
fixing some issues with wording and correcting some violations pointed out by lintian when building deb package. 2019-03-25 17:23:30 -07:00
Renan DelValle
af21dd67c7
bug fix: wrong monitor value being used for slaPercentage. 2019-03-25 13:00:58 -07:00
Renan DelValle
c1abfd5c01
Adding more sane initial values to sla drain commands. 2019-03-25 12:09:41 -07:00
Renan DelValle
3c817a7ffc
Workaround for intervals and timeout being dependent on the init execution order. 2019-03-25 11:38:17 -07:00
Renan DelValle
ddc9bc408a
Hide commands that aren't terribly useful to end users. 2019-03-25 08:30:25 -07:00
Renan DelValle
1a18f21e46
Removing stub for kill entire cluster command. 2019-03-25 08:27:47 -07:00
Renan DelValle
0409d1cd5d
Changing incorrect description of docs verb. 2019-03-22 20:54:13 -07:00
Renan DelValle
fa2249bdba
Add local building instructions. 2019-03-22 20:52:20 -07:00
Renan DelValle
724fdd8799
Updating documentation and adding monitor verb and noun. 2019-03-22 20:50:41 -07:00
Renan DelValle
d1097f33ac
bugfix: monitor variables were dependent on order in which commands were initialized inside on init(). Using PreRun we can control the value per command called by having the function run only when the function is executed. 2019-03-22 20:47:42 -07:00
Renan DelValle
fee20090d0
Making SLA-Aware to plain Drain timeout configurable.
Upgraded Dockerbuild for debian package to use go1.12.1
2019-03-22 19:01:20 -07:00
Renan DelValle
0f19631c9a
Upgrading version of go australis is built with. Added script to build debian package inside of docker container for easy distribution in a debian environment. 2019-03-21 16:09:44 -07:00
Renan DelValle
0a5607d5b4
Adding auto-generated docs. 2019-03-21 15:49:40 -07:00
Renan DelValle
ef935d58b8
Bumping up version for release. 2019-03-21 12:34:01 -07:00
Renan DelValle
7286d2fc9f
Adding rudimentary support for creating jobs on Aurora. 2019-03-21 12:26:14 -07:00
Renan DelValle
ada7eb3aa1
Changing fetch task status to only return live instances. 2019-03-19 17:04:14 -07:00
Renan DelValle
616d4bc57e
goimports style fixes. 2019-03-19 15:28:24 -07:00
Renan DelValle
4551231644
Adding fetch task status. Changed how logrus is used to be able to be passed down to gorealis. 2019-03-19 15:27:20 -07:00
Renan DelValle
2abd691a1c
Adding support for triggering an update rollback. 2019-03-19 14:55:22 -07:00
Renan DelValle
f2d18eb151
Adding gitattributes to ignore vendored folder, Gopkg.lock, and go.sum 2019-02-13 22:08:08 -08:00
Renan DelValle
5056eff933
Adding version number to imports in several files. 2019-01-31 18:15:11 -08:00
Renan DelValle
f7c1b26cfd
Improving which files to ignore in repository. Updating go.sum although for now it doesn't work very well due to a go mod bug. 2018-12-28 09:01:49 -08:00
Renan DelValle
733444645a
Changing how we build the go binary now that we're in a custom docker image. 2018-12-28 09:00:53 -08:00
Renan DelValle
7b7c8714a3
Adding Dockerfile which can be used to build image to build debian package for xenial more reliably. 2018-12-28 08:59:52 -08:00
Renan DelValle
cb8b2122b0
Adding mod support to Australis. 2018-12-27 12:18:10 -08:00
Renan DelValle
6ab5c9334d
gorealis v2 refactor (#5)
* Changing default timeout for start maintenance.

* Upgrading dependencies to gorealis v2 and thrift  0.12.0

* Refactored to update to gorealis v2.
2018-12-27 11:31:51 -08:00
Renan DelValle
ad4dd9606e
Added filename outoput for autocomplete verb. Modified debian package generator to include autocomplete. Added instructions to readme to build debian package. 2018-12-05 15:12:49 -08:00
Renan DelValle
61d78cb77e
Adding set quota command. 2018-12-04 18:37:05 -08:00
Renan DelValle
2bd703b2db
Bug fix, print results instead of details. 2018-12-04 18:36:47 -08:00
Renan DelValle
38630d8b94
Increase timeouts for drain monitors. 2018-12-04 16:21:12 -08:00
Renan DelValle
ef76abd73c
Changing timeouts to Duration types for giving the user an easier time setting high amoutns of time. Added support for sla-drain count and percentage policies. Coordination policy is to be implemented. Bumped up version number and fixed eimplicit recon calling the wrong API function. 2018-11-20 20:11:21 -08:00
Renan DelValle
2de607464f
Adding bash completion generation. 2018-11-16 22:15:36 -08:00
Renan DelValle
a559137fe3
Adding initial support for printing results in JSON format. Adding Logrus logging and adding a logging level argument. Adding StartMaintenance API. 2018-11-16 21:54:18 -08:00
Renan DelValle
6ce6411ee0
Updating dependencies. 2018-11-16 21:52:45 -08:00
Renan DelValle
c03901c0f1
Upgrading dependencies to include logrus. 2018-11-09 15:59:12 -08:00
Renan DelValle
bc28198c2d
Adding ability to print out responses as JSON. 2018-11-09 15:58:26 -08:00
3645 changed files with 4777 additions and 1270409 deletions

3
.gitattributes vendored Normal file
View file

@ -0,0 +1,3 @@
vendor/ linguist-generated=true
Gopkg.lock linguist-generated=true
Gopkg.sum linguist-generated=true

29
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Go for use with actions
uses: actions/setup-go@v2
with:
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`
- name: Run tests
run: go build -o australis *.go

7
.gitignore vendored
View file

@ -4,3 +4,10 @@ debian/debhelper-build-stamp
debian/files
debian/australis.substvars
build/
dist/
.idea/
# Use checksum database
go.sum
.DS_Store

View file

@ -1,3 +1,70 @@
1.0.6 (unreleased)
1.0.5
* fetch mesos & aurora master nodes
* kill an instance from a job
1.0.4
* fetch free capacity
* simulate task fitting - compute how many tasks can be fit in the remaining capacity
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
* 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
* Removed support for building with dep
* Upgraded depdencies to their latest versions.
* gorealis v2 now lives in the aurora-scheduler organization and dependencies have been updated to reflect that.
0.1.0
* Adding support for drain sub-command to take in JSON list from stdin or from a specified file.
* Added flags `json-file` and `json` to drain, maintenance, and sla-drain.
0.0.9
* Added ability to create jobs which contain an executorless docker container.
* Sla-aware draining sub-command has been simplified. Instead of having a count/percentage
subcommand, it now has a flag for each of these options. The count and percentage flag are
mutually exclusive, and one of them has to be set.
0.0.8
* Updated default timeouts and durations for sla-aware draining.
* Added monitor verb along with hosts noun.
* Fixed bug with monitor not using the correct default values for sla-aware drain policies.
0.0.7
* Initial migration to gorealis v2
* Implemented first version of create feature which takes in a YAML file.
* Added new noun to fetch status called task. Task also has two subcommands, status and config.
0.0.6
* Added auto-completion to the deb file.
* Added set verb and quota noun to set quota resource for certain roles.
* Added JSON output as an option for all commands.
0.0.5
* Backup and snapshot commands have now been moved to under the force subcommand as these are expensive operations

189
Gopkg.lock generated
View file

@ -1,189 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "0.10.0-http-client-fix"
digest = "1:2b8c4f3c06ddb304a24ba8a625aa9f583c5576743356fa41e48c63e1563021d2"
name = "git.apache.org/thrift.git"
packages = ["lib/go/thrift"]
pruneopts = ""
revision = "cb1afec972a85791e9b24a04b60fc9dbbfc3cda3"
source = "github.com/rdelval/thrift"
[[projects]]
digest = "1:eb53021a8aa3f599d29c7102e65026242bdedce998a54837dc67f14b6a97c5fd"
name = "github.com/fsnotify/fsnotify"
packages = ["."]
pruneopts = ""
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
version = "v1.4.7"
[[projects]]
digest = "1:d14365c51dd1d34d5c79833ec91413bfbb166be978724f15701e17080dc06dec"
name = "github.com/hashicorp/hcl"
packages = [
".",
"hcl/ast",
"hcl/parser",
"hcl/printer",
"hcl/scanner",
"hcl/strconv",
"hcl/token",
"json/parser",
"json/scanner",
"json/token",
]
pruneopts = ""
revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241"
version = "v1.0.0"
[[projects]]
digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be"
name = "github.com/inconshreveable/mousetrap"
packages = ["."]
pruneopts = ""
revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
version = "v1.0"
[[projects]]
digest = "1:961dc3b1d11f969370533390fdf203813162980c858e1dabe827b60940c909a5"
name = "github.com/magiconair/properties"
packages = ["."]
pruneopts = ""
revision = "c2353362d570a7bfa228149c62842019201cfb71"
version = "v1.8.0"
[[projects]]
digest = "1:bcc46a0fbd9e933087bef394871256b5c60269575bb661935874729c65bbbf60"
name = "github.com/mitchellh/mapstructure"
packages = ["."]
pruneopts = ""
revision = "3536a929edddb9a5b34bd6861dc4a9647cb459fe"
version = "v1.1.2"
[[projects]]
branch = "master"
digest = "1:7399006765ca37c19dbfb00d5c3e72160984ba5996669a582a0bcbe2445119bf"
name = "github.com/paypal/gorealis"
packages = [
".",
"gen-go/apache/aurora",
"response",
]
pruneopts = ""
revision = "2306d6180fc302124ffa23fb18783fc1fd794db9"
[[projects]]
digest = "1:894aef961c056b6d85d12bac890bf60c44e99b46292888bfa66caf529f804457"
name = "github.com/pelletier/go-toml"
packages = ["."]
pruneopts = ""
revision = "c01d1270ff3e442a8a57cddc1c92dc1138598194"
version = "v1.2.0"
[[projects]]
digest = "1:df48fb76fb2a40edea0c9b3d960bc95e326660d82ff1114e1f88001f7a236b40"
name = "github.com/pkg/errors"
packages = ["."]
pruneopts = ""
revision = "e881fd58d78e04cf6d0de1217f8707c8cc2249bc"
[[projects]]
digest = "1:78bea5e26e82826dacc5fd64a1013a6711b7075ec8072819b89e6ad76cb8196d"
name = "github.com/samuel/go-zookeeper"
packages = ["zk"]
pruneopts = ""
revision = "471cd4e61d7a78ece1791fa5faa0345dc8c7d5a5"
[[projects]]
digest = "1:d0431c2fd72e39ee43ea7742322abbc200c3e704c9102c5c3c2e2e667095b0ca"
name = "github.com/spf13/afero"
packages = [
".",
"mem",
]
pruneopts = ""
revision = "d40851caa0d747393da1ffb28f7f9d8b4eeffebd"
version = "v1.1.2"
[[projects]]
digest = "1:d0b38ba6da419a6d4380700218eeec8623841d44a856bb57369c172fbf692ab4"
name = "github.com/spf13/cast"
packages = ["."]
pruneopts = ""
revision = "8965335b8c7107321228e3e3702cab9832751bac"
version = "v1.2.0"
[[projects]]
digest = "1:9ba49264cef4386aded205f9cb5b1f2d30f983d7dc37a21c780d9db3edfac9a7"
name = "github.com/spf13/cobra"
packages = ["."]
pruneopts = ""
revision = "fe5e611709b0c57fa4a89136deaa8e1d4004d053"
[[projects]]
digest = "1:9ceffa4ab5f7195ecf18b3a7fff90c837a9ed5e22e66d18069e4bccfe1f52aa0"
name = "github.com/spf13/jwalterweatherman"
packages = ["."]
pruneopts = ""
revision = "4a4406e478ca629068e7768fc33f3f044173c0a6"
version = "v1.0.0"
[[projects]]
digest = "1:cbaf13cdbfef0e4734ed8a7504f57fe893d471d62a35b982bf6fb3f036449a66"
name = "github.com/spf13/pflag"
packages = ["."]
pruneopts = ""
revision = "298182f68c66c05229eb03ac171abe6e309ee79a"
version = "v1.0.3"
[[projects]]
digest = "1:c08585b9af4c0f3c516af8e06254a66b462aee46937d41b7d8434795051e33b6"
name = "github.com/spf13/viper"
packages = ["."]
pruneopts = ""
revision = "62edee319679b6ceaec16de03b966102d2dea709"
[[projects]]
branch = "master"
digest = "1:3d1785223d1b588249f131ddb1a88b1f80ee3eaa20934aba6562a44e633bbe7d"
name = "golang.org/x/sys"
packages = ["unix"]
pruneopts = ""
revision = "44b849a8bc13eb42e95e6c6c5e360481b73ec710"
[[projects]]
digest = "1:5acd3512b047305d49e8763eef7ba423901e85d5dd2fd1e71778a0ea8de10bd4"
name = "golang.org/x/text"
packages = [
"internal/gen",
"internal/triegen",
"internal/ucd",
"transform",
"unicode/cldr",
"unicode/norm",
]
pruneopts = ""
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[[projects]]
digest = "1:f0620375dd1f6251d9973b5f2596228cc8042e887cd7f827e4220bc1ce8c30e2"
name = "gopkg.in/yaml.v2"
packages = ["."]
pruneopts = ""
revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
version = "v2.2.1"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"git.apache.org/thrift.git/lib/go/thrift",
"github.com/paypal/gorealis",
"github.com/paypal/gorealis/gen-go/apache/aurora",
"github.com/spf13/cobra",
"github.com/spf13/viper",
]
solver-name = "gps-cdcl"
solver-version = 1

View file

@ -1,18 +0,0 @@
required = ["git.apache.org/thrift.git/lib/go/thrift"]
[[constraint]]
name = "github.com/paypal/gorealis"
branch = "master"
[[constraint]]
name = "github.com/spf13/cobra"
revision = "fe5e611709b0c57fa4a89136deaa8e1d4004d053"
[[constraint]]
name = "github.com/spf13/viper"
revision = "62edee319679b6ceaec16de03b966102d2dea709"
[[constraint]]
name = "git.apache.org/thrift.git"
branch = "0.10.0-http-client-fix"
source = "github.com/rdelval/thrift"

View file

@ -1,56 +1,17 @@
# Australis
A light-weight client for [Apache Aurora](https://aurora.apache.org/) built using [gorealis](https://github.com/paypal/gorealis).
A light-weight client for [Aurora Scheduler](https://aurora-scheduler.github.io/) built using [gorealis](https://github.com/aurora-scheduler/gorealis).
## Usage
```
A light-weight command line client for use with Apache Aurora built using gorealis.
Usage:
australis [command]
Available Commands:
create Create an Aurora Job
fetch Fetch information from Aurora
help Help about any command
kill Kill an Aurora Job
start Start a service, maintenance on a host (DRAIN), a snapshot, or a backup.
stop Stop a service or maintenance on a host (DRAIN).
Flags:
-a, --caCertsPath string CA certificates path to use.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
-h, --help help for australis
-i, --insecureSkipVerify Skip verification.
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information.
Use "australis [command] --help" for more information about a command.
```
## Sample commands:
### Fetching current leader
`australis fetch leader [ZK NODE 1] [ZK NODE 2]...[ZK NODE N]`
### Fetching status/mode of a agent
`australis fetch status [HOST 1] [HOST 2]...[HOST N]`
### Setting host to DRAIN:
`australis start drain [HOST 1] [HOST 2]...[HOST N]`
### Taking hosts out of DRAIN (End maintenance):
`australis stop drain [HOST 1] [HOST 2]...[HOST N]`
### Force a snapshot
`australis force snapshot`
### Force a backup
`australis force backup`
## Usage
See the [documentation](docs/australis.md) for more information.
## Status
Australis is a work in progress and does not support all the features of Apache Aurora.
Australis is a work in progress and does not support all the features of Aurora Scheduler.
### Build locally
This project uses go mods. To build locally run:
`$ go build -o australis main.go`
### Building debian package
From the inside of the deb-packaging folder, run [build_deb.sh](deb-packaging/build_deb.sh)

44
cmd/completion.go Normal file
View file

@ -0,0 +1,44 @@
/**
* 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 (
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(completionCmd)
completionCmd.Hidden = true
completionCmd.Flags().StringVar(&filename, "filename", "australis.completion.sh", "Path and name of the autocompletion file.")
}
var completionCmd = &cobra.Command{
Use: "autocomplete",
Short: "Create auto completion for bash.",
Long: `Create auto completion bash file for australis. Auto completion file must be placed in the correct
directory in order for bash to pick up the definitions.
Copy australis.completion.sh into the correct folder and rename to australis
In Linux, this directory is usually /etc/bash_completion.d/
In MacOS this directory is $(brew --prefix)/etc/bash_completion.d if auto completion was install through brew.
`,
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
Run: func(cmd *cobra.Command, args []string) {
rootCmd.GenBashCompletionFile(filename)
},
}

View file

@ -1,27 +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(createCmd)
createCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
createCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
createCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
createCmd.MarkFlagRequired("environment")
createCmd.MarkFlagRequired("role")
createCmd.MarkFlagRequired("name")
createCmd.Flags().BoolVarP(&monitor, "monitor", "m", true, "monitor the result after sending the command")
}
var createCmd = &cobra.Command{
Use: "create",
Short: "Create an Aurora Job",
Run: createJob,
Args: cobra.RangeArgs(1, 2),
}
func createJob(cmd *cobra.Command, args []string) {
fmt.Println("Not implemented yet.")
job, err := internal.UnmarshalJob(args[0])
if err != nil {
log.Fatalln(err)
}
auroraJob, err := job.ToRealis()
if err != nil {
log.Fatalln(err)
}
if err := client.CreateJob(auroraJob); err != nil {
log.Fatal("unable to create Aurora job: ", 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)
}
}
}

38
cmd/docs.go Normal file
View file

@ -0,0 +1,38 @@
/**
* 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 (
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)
func init() {
rootCmd.AddCommand(docsCmd)
docsCmd.Hidden = true
}
var docsCmd = &cobra.Command{
Use: "docs",
Short: "Generate documents in markdown format for Australis.",
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
Run: func(cmd *cobra.Command, args []string) {
err := doc.GenMarkdownTree(rootCmd, "./docs")
if err != nil {
log.Fatal(err)
}
},
}

View file

@ -1,55 +1,179 @@
/**
* 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 (
"encoding/json"
"errors"
"fmt"
"os"
"github.com/paypal/gorealis"
"github.com/paypal/gorealis/gen-go/apache/aurora"
"io/ioutil"
"net/http"
"strings"
"github.com/aurora-scheduler/australis/internal"
realis "github.com/aurora-scheduler/gorealis/v2"
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
"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)
// Sub-commands
// Fetch Task Config
fetchCmd.AddCommand(taskConfigCmd)
fetchCmd.AddCommand(fetchTaskCmd)
// Fetch Task Config
fetchTaskCmd.AddCommand(taskConfigCmd)
taskConfigCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
taskConfigCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
taskConfigCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
/* Fetch Leader */
// Fetch Task Status
fetchTaskCmd.AddCommand(taskStatusCmd)
taskStatusCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
taskStatusCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
taskStatusCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
/* Fetch Leader */
leaderCmd.Flags().String("zkPath", "/aurora/scheduler", "Zookeeper node path where leader election happens")
// Override usage template to hide global flags
leaderCmd.SetUsageTemplate(`Usage:{{if .Runnable}}
{{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
{{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
Aliases:
{{.NameAndAliases}}{{end}}{{if .HasExample}}
Examples:
{{.Example}}{{end}}{{if .HasAvailableSubCommands}}
Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}
Flags:
{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
`)
fetchCmd.AddCommand(leaderCmd)
// Hijack help function to hide unnecessary global flags
help := leaderCmd.HelpFunc()
leaderCmd.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)
})
mesosLeaderCmd.Flags().String("zkPath", "/mesos", "Zookeeper node path where mesos leader election happens")
mesosCmd.AddCommand(mesosLeaderCmd)
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 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)
// Fetch Status
fetchCmd.AddCommand(fetchStatusCmd)
// 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)
})
// 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{
@ -57,21 +181,77 @@ var fetchCmd = &cobra.Command{
Short: "Fetch information from Aurora",
}
var fetchTaskCmd = &cobra.Command{
Use: "task",
Short: "Task information from Aurora",
}
var taskConfigCmd = &cobra.Command{
Use: "config",
Short: "Fetch a list of task configurations from Aurora.",
Long: `To be written.`,
Run: fetchTasks,
Run: fetchTasksConfig,
}
var taskStatusCmd = &cobra.Command{
Use: "status",
Short: "Fetch task status for a Job key.",
Long: `To be written.`,
Run: fetchTasksStatus,
}
var leaderCmd = &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
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 leader given Zookeeper nodes. ",
Long: `Gets the current leading aurora scheduler instance using information from Zookeeper path.
Long: `Gets the current leading aurora scheduler instance using information from Zookeeper path.
Pass Zookeeper nodes separated by a space as an argument to this command.`,
Run: fetchLeader,
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,
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.",
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. If no nodes are provided,
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{
@ -82,14 +262,36 @@ var fetchJobsCmd = &cobra.Command{
}
var fetchStatusCmd = &cobra.Command{
Use: "status",
Use: "status",
Short: "Fetch the maintenance status of a node from Aurora",
Long: `This command will print the actual status of the mesos agent nodes in Aurora server`,
Run: fetchStatus,
Long: `This command will print the actual status of the mesos agent nodes in Aurora server`,
Run: fetchHostStatus,
}
func fetchTasks(cmd *cobra.Command, args []string) {
fmt.Printf("Fetching job configuration for [%s/%s/%s] \n", env, role, name)
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,
}
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,
}
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)
// Task Query takes nil for values it shouldn't need to match against.
// This allows us to potentially more expensive calls for specific environments, roles, or job names.
@ -107,69 +309,377 @@ func fetchTasks(cmd *cobra.Command, args []string) {
tasks, err := client.GetTasksWithoutConfigs(taskQuery)
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %+v", err)
}
for _, t := range tasks {
fmt.Println(t)
if toJson {
fmt.Println(internal.ToJSON(tasks))
} else {
for _, t := range tasks {
fmt.Println(t)
}
}
}
func fetchStatus(cmd *cobra.Command, args []string) {
fmt.Printf("Fetching maintenance status for %v \n", args)
_, result, err := client.MaintenanceStatus(args...)
func fetchTasksStatus(cmd *cobra.Command, args []string) {
log.Infof("Fetching task status for [%s/%s/%s] \n", *env, *role, *name)
// Task Query takes nil for values it shouldn't need to match against.
// This allows us to potentially more expensive calls for specific environments, roles, or job names.
if *env == "" {
env = nil
}
if *role == "" {
role = nil
}
if *role == "" {
role = nil
}
// TODO(rdelvalle): Add filtering down by status
taskQuery := &aurora.TaskQuery{
Environment: env,
Role: role,
JobName: name,
Statuses: aurora.LIVE_STATES}
tasks, err := client.GetTaskStatus(taskQuery)
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %+v", err)
}
for k := range result.Statuses {
fmt.Printf("Result: %s:%s\n", k.Host, k.Mode)
if toJson {
fmt.Println(internal.ToJSON(tasks))
} else {
for _, t := range tasks {
fmt.Println(t)
}
}
}
func fetchHostStatus(cmd *cobra.Command, args []string) {
log.Infof("Fetching maintenance status for %v \n", args)
result, err := client.MaintenanceStatus(args...)
if err != nil {
log.Fatalf("error: %+v\n", err)
}
if toJson {
fmt.Println(internal.ToJSON(result.Statuses))
} else {
for _, k := range result.GetStatuses() {
fmt.Printf("Result: %s:%s\n", k.Host, k.Mode)
}
}
}
func fetchLeader(cmd *cobra.Command, args []string) {
fmt.Printf("Fetching leader from %v \n", args)
log.Infof("Fetching leader from %v \n", args)
if len(args) < 1 {
fmt.Println("At least one Zookeper node address must be passed in.")
os.Exit(1)
log.Fatalln("At least one Zookeeper node address must be passed in.")
}
url, err := realis.LeaderFromZKOpts(realis.ZKEndpoints(args...), realis.ZKPath(cmd.Flag("zkPath").Value.String()))
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %+v\n", err)
}
fmt.Println(url)
}
func fetchMesosLeader(cmd *cobra.Command, args []string) {
if len(args) < 1 {
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 Zookeeper node(s): %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)
}
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 {
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) {
fmt.Printf("Fetching tasks under role: %s \n", *role)
func fetchJobs(cmd *cobra.Command, args []string) {
log.Infof("Fetching tasks under role: %s \n", *role)
if *role == "" {
fmt.Println("Role must be specified.")
os.Exit(1)
log.Fatalln("Role must be specified.")
}
if *role == "*" {
fmt.Println("Warning: This is an expensive operation.")
log.Warnln("This is an expensive operation.")
*role = ""
}
_, result, err := client.GetJobs(*role)
result, err := client.GetJobs(*role)
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %+v", err)
}
for jobConfig, _ := range result.GetConfigs() {
fmt.Println(jobConfig)
}
if toJson {
var configSlice []*aurora.JobConfiguration
for _, config := range result.GetConfigs() {
configSlice = append(configSlice, config)
}
fmt.Println(internal.ToJSON(configSlice))
} else {
for jobConfig := range result.GetConfigs() {
fmt.Println(jobConfig)
}
}
}
//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()))
}
}
}
//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)
}
}
//fetchTasksWithStatus returns lists of tasks for a given set of status
func fetchTasksWithStatus(cmd *cobra.Command, args []string) {
status := *taskStatus
log.Infof("Fetching tasks for role/environment/job:[%s/%s/%s] \n", *role, *env, *name)
log.Infof("Fetching tasks for a given status: %v \n", status)
// This Query takes nil for values it shouldn't need to match against.
// This allows us to potentially avoid expensive calls for specific environments, roles, or job names.
if *env == "" {
env = nil
}
if *role == "" {
role = nil
}
if *name == "" {
name = nil
}
// role needs to be specified if env is specified
if env != nil {
if role == nil {
log.Fatalln("Role must be specified when env is specified.")
}
}
// role or env needs to be specified if name is specified
if name != nil {
if role == nil && env == nil {
log.Fatalln("Role or env must be specified when name is specified.")
}
}
queryStatuses, err := scheduleStatusFromString(status)
if err != nil {
log.Fatalf("error: %+v", err)
}
taskQuery := &aurora.TaskQuery{Environment: env, Role: role, JobName: name, Statuses: queryStatuses}
tasks, err := client.GetTasksWithoutConfigs(taskQuery)
if err != nil {
log.Fatalf("error: %+v", err)
}
if toJson {
taskStatus := strings.ToUpper(status)
// convert task lists to a list of task id like role-env-name-[instance-id]
taskIdsMap := map[string][]string{}
var taskIds []string
for _, task := range tasks {
taskIds = append(taskIds, task.AssignedTask.TaskId)
}
taskIdsMap[taskStatus] = taskIds
fmt.Println(internal.ToJSON(taskIdsMap))
} else {
fmt.Printf("Tasks for status %s:\n", strings.ToUpper(status))
for _, t := range tasks {
fmt.Println(t.AssignedTask.TaskId)
}
}
}
// Convert status slice into ScheduleStatus slice
func scheduleStatusFromString(status string) ([]aurora.ScheduleStatus, error) {
scheduleStatus, err := aurora.ScheduleStatusFromString(strings.ToUpper(status))
if err != nil {
return nil, err
}
result := []aurora.ScheduleStatus{scheduleStatus}
return result, nil
}

View file

@ -1,8 +1,21 @@
/**
* 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"
"os"
"strconv"
"github.com/spf13/cobra"
@ -13,7 +26,7 @@ func init() {
// Sub-commands
forceCmd.AddCommand(forceSnapshotCmd)
forceCmd.AddCommand(forceBackupCmd)
forceCmd.AddCommand(forceBackupCmd)
// Recon sub-commands
forceCmd.AddCommand(reconCmd)
@ -31,17 +44,16 @@ var forceSnapshotCmd = &cobra.Command{
Short: "Force the leading scheduler to perform a Snapshot.",
Long: `Takes a Snapshot of the in memory state of the Apache Aurora cluster and
writes it to the Mesos replicated log. This should NOT be confused with a backup.`,
Run: snapshot,
Run: snapshot,
}
func snapshot(cmd *cobra.Command, args []string) {
fmt.Println("Forcing scheduler to write snapshot to Mesos replicated log")
err := client.Snapshot()
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %+v\n", err)
} else {
fmt.Println("Snapshot started successfully")
log.Println("Snapshot started successfully")
}
}
@ -50,17 +62,16 @@ var forceBackupCmd = &cobra.Command{
Short: "Force the leading scheduler to perform a Backup.",
Long: `Force the Aurora Scheduler to write a backup of the latest snapshot to the filesystem
of the leading scheduler.`,
Run: backup,
Run: backup,
}
func backup(cmd *cobra.Command, args []string) {
fmt.Println("Forcing scheduler to write a Backup of latest Snapshot to file system")
err := client.PerformBackup()
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %+v", err)
} else {
fmt.Println("Backup started successfully")
log.Println("Backup started successfully")
}
}
@ -78,10 +89,10 @@ state for all currently known non-terminal tasks.
}
var forceExplicitReconCmd = &cobra.Command{
Use: "explicit",
Use: "explicit [batch_size]",
Short: "Force the leading scheduler to perform an explicit recon.",
Long: `Aurora will send a list of non-terminal task IDs
and the master responds with the latest state for each task, if possible.
Long: `Aurora will send a list of non-terminal task IDs and the master
responds with the latest state for each task, if possible.
`,
Run: explicitRecon,
Args: cobra.MaximumNArgs(1),
@ -90,31 +101,29 @@ and the master responds with the latest state for each task, if possible.
func explicitRecon(cmd *cobra.Command, args []string) {
var batchSize *int32
fmt.Println("Forcing scheduler to perform an explicit reconciliation with Mesos")
log.Println("Forcing scheduler to perform an explicit reconciliation with Mesos")
switch len(args) {
case 0:
fmt.Println("Using default batch size for explicit recon.")
log.Infoln("Using default batch size for explicit recon.")
case 1:
fmt.Printf("Using %v as batch size for explicit recon.\n", args[0])
log.Infof("Using %v as batch size for explicit recon.\n", args[0])
// Get batch size from args and convert it to the right format
// Get batch size from args and convert it to the right format
batchInt, err := strconv.Atoi(args[0])
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
}
if err != nil {
log.Fatalf("error: %v", err)
}
batchInt32 := int32(batchInt)
batchSize = &batchInt32
default:
fmt.Println("Provide 0 arguments to use default batch size or one argument to use a custom batch size.")
os.Exit(1)
default:
log.Fatalln("Provide 0 arguments to use default batch size or one argument to use a custom batch size.")
}
err := client.ForceExplicitTaskReconciliation(batchSize)
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %v", err)
} else {
fmt.Println("Explicit reconciliation started successfully")
}
@ -123,17 +132,17 @@ func explicitRecon(cmd *cobra.Command, args []string) {
var forceImplicitReconCmd = &cobra.Command{
Use: "implicit",
Short: "Force the leading scheduler to perform an implicit recon.",
Long: `Force the `,
Run: implicitRecon,
Long: `Forces leading scheduler to ask Mesos Master for a list of the latest state for
all currently known non-terminal tasks being run by Aurora.`,
Run: implicitRecon,
}
func implicitRecon(cmd *cobra.Command, args []string) {
fmt.Println("Forcing scheduler to perform an implicit reconciliation with Mesos")
err := client.PerformBackup()
log.Println("Forcing scheduler to perform an implicit reconciliation with Mesos")
err := client.ForceImplicitTaskReconciliation()
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %+v", err)
} else {
fmt.Println("Implicit reconciliation started successfully")
}

View file

@ -1,35 +1,54 @@
/**
* 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"
"log"
"os"
"strconv"
"strings"
"github.com/paypal/gorealis"
realis "github.com/aurora-scheduler/gorealis/v2"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(killCmd)
/* Sub-Commands */
// Kill Job
killCmd.AddCommand(killJobCmd)
killCmd.AddCommand(killTasksCmd)
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", true, "monitor the result after sending the command")
killJobCmd.MarkFlagRequired("environment")
killJobCmd.MarkFlagRequired("role")
killJobCmd.MarkFlagRequired("name")
// Kill every task in the Aurora cluster
killCmd.AddCommand(killEntireClusterCmd)
//Set flags for killTask sub-command
killTasksCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
killTasksCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
killTasksCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
killTasksCmd.Flags().StringVarP(instances, "instances", "I", "", "Instances e.g. 1, 2, 5")
killTasksCmd.Flags().BoolVarP(&monitor, "monitor", "m", true, "monitor the result after sending the command")
killTasksCmd.MarkFlagRequired("environment")
killTasksCmd.MarkFlagRequired("role")
killTasksCmd.MarkFlagRequired("name")
killTasksCmd.MarkFlagRequired("instances")
}
var killCmd = &cobra.Command{
@ -43,35 +62,78 @@ var killJobCmd = &cobra.Command{
Run: killJob,
}
var killEntireClusterCmd = &cobra.Command{
Use: "entire-cluster",
Short: "Kill every task in the cluster.",
Long: `To be written.`,
Run: killEntireCluster,
/*
* 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.Printf("Killing job [Env:%s Role:%s Name:%s]\n", *env, *role, *name)
log.Infof("Killing job [Env:%s Role:%s Name:%s]\n", *env, *role, *name)
job := realis.NewJob().
Environment(*env).
Role(*role).
Name(*name)
resp, err := client.KillJob(job.JobKey())
err := client.KillJob(job.JobKey())
if err != nil {
fmt.Println(err)
os.Exit(1)
log.Fatalln(err)
}
if monitor {
if ok, err := client.MonitorInstances(job.JobKey(), 0, 5, 50); !ok || err != nil {
log.Fatalln("Unable to kill all instances of job")
}
}
}
func killTasks(cmd *cobra.Command, args []string) {
log.Infof("Killing task [Env:%s Role:%s Name:%s Instance:%s]\n", *env, *role, *name, *instances)
//Set jobKey for the tasks to be killed.
task := realis.NewTask().
Environment(*env).
Role(*role).
Name(*name)
/*
* In the following block, we convert instance numbers, which were passed as strings, to integer values
* After converting them to integers, we add them to a slice of type int32.
*/
splitString := strings.Split(*instances, ",")
instanceList := make([]int32, len(splitString))
for i := range instanceList {
splitString[i] = strings.TrimSpace(splitString[i])
instanceNumber, intErr := strconv.Atoi(splitString[i])
if intErr != nil {
log.Fatalln("Instance passed should be a number. Error: " + intErr.Error())
return
} else {
instanceList[i] = int32(instanceNumber)
}
}
if ok, err := monitor.Instances(job.JobKey(), 0, 5, 50); !ok || err != nil {
log.Println("Unable to kill all instances of job")
os.Exit(1)
}
//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)
}
fmt.Println(resp.String())
}
func killEntireCluster(cmd *cobra.Command, args []string) {
log.Println("This command will kill every single task inside of a cluster.")
log.Println("Not implemented yet.")
if monitor {
if ok, err := client.MonitorInstances(task.JobKey(), 0, 5, 50); !ok || err != nil {
log.Fatalln("Unable to kill the given task")
}
}
}

72
cmd/monitor.go Normal file
View file

@ -0,0 +1,72 @@
/**
* 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 (
"strings"
"time"
"github.com/aurora-scheduler/australis/internal"
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(monitorCmd)
monitorCmd.AddCommand(monitorHostCmd.Cmd)
monitorHostCmd.Cmd.Run = monitorHost
monitorHostCmd.Cmd.Flags().DurationVar(&monitorHostCmd.MonitorInterval, "interval", time.Second*5, "Interval at which to poll scheduler.")
monitorHostCmd.Cmd.Flags().DurationVar(&monitorHostCmd.MonitorTimeout, "timeout", time.Minute*10, "Time after which the monitor will stop polling and throw an error.")
monitorHostCmd.Cmd.Flags().StringSliceVar(&monitorHostCmd.StatusList, "statuses", []string{aurora.MaintenanceMode_DRAINED.String()}, "List of acceptable statuses for a host to be in. (case-insensitive) [NONE, SCHEDULED, DRAINED, DRAINING]")
}
var monitorCmd = &cobra.Command{
Use: "monitor",
Short: "Watch for a specific state change",
}
var monitorHostCmd = internal.MonitorCmdConfig{
Cmd: &cobra.Command{
Use: "hosts",
Short: "Watch a host maintenance status until it enters one of the desired statuses.",
Long: `Provide a list of hosts to monitor for desired statuses. Statuses may be passed using the --statuses
flag with a list of comma separated statuses. Statuses include [NONE, SCHEDULED, DRAINED, DRAINING]`,
},
StatusList: make([]string, 0),
}
func monitorHost(cmd *cobra.Command, args []string) {
maintenanceModes := make([]aurora.MaintenanceMode, 0)
for _, status := range monitorHostCmd.StatusList {
mode, err := aurora.MaintenanceModeFromString(strings.ToUpper(status))
if err != nil {
log.Fatal(err)
}
maintenanceModes = append(maintenanceModes, mode)
}
log.Infof("Monitoring for %v at %v intervals", monitorHostCmd.MonitorTimeout, monitorHostCmd.MonitorInterval)
hostResult, err := client.MonitorHostMaintenance(args, maintenanceModes, monitorHostCmd.MonitorInterval, monitorHostCmd.MonitorTimeout)
internal.MaintenanceMonitorPrint(hostResult, maintenanceModes, toJson)
if err != nil {
log.Fatal(err)
}
}

47
cmd/pulse.go Normal file
View file

@ -0,0 +1,47 @@
/**
* 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 (
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(pulseJobUpdateCmd)
pulseJobUpdateCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
pulseJobUpdateCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
pulseJobUpdateCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
pulseJobUpdateCmd.Flags().StringVar(&updateID, "id", "", "Update ID")
}
var pulseJobUpdateCmd = &cobra.Command{
Use: "pulse",
Short: "Pulse a Job update",
Run: pulseJobUpdate,
}
func pulseJobUpdate(cmd *cobra.Command, args []string) {
_, err := client.PulseJobUpdate(
aurora.JobUpdateKey{
Job: &aurora.JobKey{Environment: *env, Role: *role, Name: *name},
ID: updateID,
})
if err != nil {
log.Fatal(err)
}
}

110
cmd/restart.go Normal file
View file

@ -0,0 +1,110 @@
/**
* 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 (
"strconv"
"strings"
realis "github.com/aurora-scheduler/gorealis/v2"
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
func init() {
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(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{
Use: "restart",
Short: "Restart an Aurora Job.",
}
var restartJobCmd = &cobra.Command{
Use: "job",
Short: "Restart a Job.",
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())
}
}
}

49
cmd/resume.go Normal file
View file

@ -0,0 +1,49 @@
/**
* 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 (
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(resumeJobUpdateCmd)
resumeJobUpdateCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
resumeJobUpdateCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
resumeJobUpdateCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
resumeJobUpdateCmd.Flags().StringVar(&updateID, "id", "", "Update ID")
resumeJobUpdateCmd.Flags().StringVar(message, "message", "", "Message to store along resume.")
}
var resumeJobUpdateCmd = &cobra.Command{
Use: "resume",
Short: "Resume a Job update",
Run: resumeJobUpdate,
}
func resumeJobUpdate(cmd *cobra.Command, args []string) {
err := client.ResumeJobUpdate(
aurora.JobUpdateKey{
Job: &aurora.JobKey{Environment: *env, Role: *role, Name: *name},
ID: updateID,
},
*message)
if err != nil {
log.Fatal(err)
}
}

65
cmd/rollback.go Normal file
View file

@ -0,0 +1,65 @@
/**
* 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/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(rollbackCmd)
rollbackCmd.AddCommand(rollbackUpdateCmd)
rollbackUpdateCmd.Flags().StringVarP(env, "environment", "e", "", "Aurora Environment")
rollbackUpdateCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
rollbackUpdateCmd.Flags().StringVarP(name, "name", "n", "", "Aurora Name")
rollbackUpdateCmd.Flags().StringVar(&updateID, "id", "", "Update ID")
rollbackUpdateCmd.Flags().StringVar(message, "message", "", "Message to store alongside resume event")
rollbackUpdateCmd.MarkFlagRequired("environment")
rollbackUpdateCmd.MarkFlagRequired("role")
rollbackUpdateCmd.MarkFlagRequired("name")
rollbackUpdateCmd.MarkFlagRequired("id")
}
var rollbackCmd = &cobra.Command{
Use: "rollback",
Short: "Rollback an operation such as an Update",
}
var rollbackUpdateCmd = &cobra.Command{
Use: "update",
Short: "Rollback an update",
Run: rollbackUpdate,
}
func rollbackUpdate(cmd *cobra.Command, args []string) {
var updateMessage string
if message != nil {
updateMessage = *message
}
err := client.RollbackJobUpdate(aurora.JobUpdateKey{
Job: &aurora.JobKey{Environment: *env, Role: *role, Name: *name},
ID: updateID,
}, updateMessage)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Rollback update for update ID %v sent successfully\n", updateID)
}

View file

@ -1,32 +1,64 @@
/**
* 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/spf13/viper"
"os"
"strings"
"time"
"strings"
"time"
"github.com/paypal/gorealis"
"github.com/spf13/cobra"
"github.com/aurora-scheduler/australis/internal"
"github.com/spf13/viper"
realis "github.com/aurora-scheduler/gorealis/v2"
"github.com/spf13/cobra"
"github.com/sirupsen/logrus"
)
var username, password, zkAddr, schedAddr string
var env, role, name = new(string), new(string), new(string)
var client realis.Realis
var monitor *realis.Monitor
var dedicated string
var ram, disk, gpu, port int64
var cpu float64
var client *realis.Client
var skipCertVerification bool
var caCertsPath string
var clientKey, clientCert string
var configFile string
var toJson bool
var fromJson bool
var fromJsonFile string
var logLevel string
var duration time.Duration
var percent float64
var count int64
var filename string
var message = new(string)
var updateID string
var monitor bool
var timeout time.Duration
var log = logrus.New()
var taskStatus = new(string)
var instances = new(string)
const australisVer = "v0.0.5"
const australisVer = "v1.0.5"
var monitorInterval, monitorTimeout int
var forceDrainTimeout time.Duration
func init() {
rootCmd.SetVersionTemplate(`{{printf "%s\n" .Version}}`)
rootCmd.PersistentFlags().StringVarP(&zkAddr, "zookeeper", "z", "", "Zookeeper node(s) where Aurora stores information. (comma separated list)")
@ -37,8 +69,10 @@ func init() {
rootCmd.PersistentFlags().StringVarP(&clientCert, "clientCert", "c", "", "Client certificate to use to connect to Aurora.")
rootCmd.PersistentFlags().StringVarP(&caCertsPath, "caCertsPath", "a", "", "Path where CA certificates can be found.")
rootCmd.PersistentFlags().BoolVarP(&skipCertVerification, "skipCertVerification", "i", false, "Skip CA certificate hostname verification.")
rootCmd.PersistentFlags().StringVar(&configFile, "config", "/etc/aurora/australis.yml", "Config file to use.")
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.")
}
var rootCmd = &cobra.Command{
@ -54,84 +88,97 @@ var rootCmd = &cobra.Command{
}
func Execute() {
rootCmd.Execute()
if err := rootCmd.Execute(); err != nil {
log.Fatal(err)
}
}
// TODO(rdelvalle): Move more from connect into this function
func setConfig(cmd *cobra.Command, args []string) {
lvl, err := logrus.ParseLevel(logLevel)
if err != nil {
log.Fatalf("Log level %v is not valid", logLevel)
}
log.SetLevel(lvl)
internal.Logger(log)
}
func connect(cmd *cobra.Command, args []string) {
var err error
var err error
zkAddrSlice := strings.Split(zkAddr, ",")
setConfig(cmd, args)
viper.SetConfigFile(configFile)
err = viper.ReadInConfig()
if err == nil {
// Best effort load configuration. Will only set config values when flags have not set them already.
if viper.IsSet("zk") && len(zkAddrSlice) == 1 && zkAddrSlice[0] == "" {
zkAddrSlice = viper.GetStringSlice("zk")
}
zkAddrSlice := strings.Split(zkAddr, ",")
if viper.IsSet("username") && username == "" {
username = viper.GetString("username")
}
viper.SetConfigFile(configFile)
err = viper.ReadInConfig()
if err == nil {
// Best effort load configuration. Will only set config values when flags have not set them already.
if viper.IsSet("zk") && len(zkAddrSlice) == 1 && zkAddrSlice[0] == "" {
zkAddrSlice = viper.GetStringSlice("zk")
}
if viper.IsSet("password") && password == "" {
password = viper.GetString("password")
}
if viper.IsSet("username") && username == "" {
username = viper.GetString("username")
}
if viper.IsSet("clientKey") && clientKey == "" {
clientKey = viper.GetString("clientKey")
}
if viper.IsSet("password") && password == "" {
password = viper.GetString("password")
}
if viper.IsSet("clientCert") && clientCert == "" {
clientCert = viper.GetString("clientCert")
}
if viper.IsSet("clientKey") && clientKey == "" {
clientKey = viper.GetString("clientKey")
}
if viper.IsSet("caCertsPath") && caCertsPath == "" {
caCertsPath = viper.GetString("caCertsPath")
}
if viper.IsSet("clientCert") && clientCert == "" {
clientCert = viper.GetString("clientCert")
}
if viper.IsSet("skipCertVerification") && !skipCertVerification {
skipCertVerification = viper.GetBool("skipCertVerification")
}
}
if viper.IsSet("caCertsPath") && caCertsPath == "" {
caCertsPath = viper.GetString("caCertsPath")
}
if viper.IsSet("skipCertVerification") && !skipCertVerification {
skipCertVerification = viper.GetBool("skipCertVerification")
}
}
realisOptions := []realis.ClientOption{realis.BasicAuth(username, password),
realis.ThriftJSON(),
realis.TimeoutMS(20000),
realis.Timeout(timeout),
realis.BackOff(realis.Backoff{
Steps: 2,
Duration: 10 * time.Second,
Factor: 2.0,
Jitter: 0.1,
})}
}),
realis.SetLogger(log)}
// Prefer zookeeper if both ways of connecting are provided
if len(zkAddrSlice) > 0 && zkAddrSlice[0] != "" {
// Configure Zookeeper to connect
zkOptions := []realis.ZKOpt{ realis.ZKEndpoints(zkAddrSlice...), realis.ZKPath("/aurora/scheduler")}
zkOptions := []realis.ZKOpt{realis.ZKEndpoints(zkAddrSlice...), realis.ZKPath("/aurora/scheduler")}
realisOptions = append(realisOptions, realis.ZookeeperOptions(zkOptions...))
} else if schedAddr != "" {
realisOptions = append(realisOptions, realis.SchedulerUrl(schedAddr))
} else {
fmt.Println("Zookeeper address or Scheduler URL must be provided.")
os.Exit(1)
log.Fatalln("Zookeeper address or Scheduler URL must be provided.")
}
// Client certificate configuration if available
if clientKey != "" || clientCert != "" || caCertsPath != "" {
realisOptions = append(realisOptions,
realis.Certspath(caCertsPath),
realis.CertsPath(caCertsPath),
realis.ClientCerts(clientKey, clientCert),
realis.InsecureSkipVerify(skipCertVerification))
}
// Connect to Aurora Scheduler and create a client object
client, err = realis.NewRealisClient(realisOptions...)
client, err = realis.NewClient(realisOptions...)
if err != nil {
fmt.Println(err)
os.Exit(1)
log.Fatal(err)
}
monitor = &realis.Monitor{Client: client}
}

52
cmd/schedule.go Normal file
View file

@ -0,0 +1,52 @@
/**
* 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 (
"github.com/aurora-scheduler/australis/internal"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(scheduleCmd)
}
var scheduleCmd = &cobra.Command{
Use: "schedule",
Short: "Schedule a cron job on Aurora scheduler",
Run: scheduleCron,
Args: cobra.ExactArgs(1),
}
func scheduleCron(cmd *cobra.Command, args []string) {
job, err := internal.UnmarshalJob(args[0])
if err != nil {
log.Fatalln(err)
}
if err := job.ValidateCron(); err != nil {
log.Fatal(err)
}
auroraJob, err := job.ToRealis()
if err != nil {
log.Fatalln(err)
}
if err := client.ScheduleCronJob(auroraJob); err != nil {
log.Fatal("unable to schedule job: ", err)
}
}

94
cmd/set.go Normal file
View file

@ -0,0 +1,94 @@
/**
* 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"
"strconv"
"strings"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(setCmd)
// Set Sub-commands
setCmd.AddCommand(setQuotaCmd)
}
var setCmd = &cobra.Command{
Use: "set",
Short: "Set a value in the Aurora Scheduler.",
}
var setQuotaCmd = &cobra.Command{
Use: "quota <role> cpu:<value> ram:<value> disk:<value>",
Short: "Set Quota resources for a role.",
Long: `Quotas can be set for roles in Aurora. Using this command we can set the resources reserved a role.`,
Run: setQuota,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 4 {
return fmt.Errorf("role, cpu, ram, and disk resources must be provided")
}
*role = args[0]
for i := 1; i < len(args); i++ {
resourcePair := strings.Split(args[i], ":")
if len(resourcePair) != 2 {
return fmt.Errorf("all resources must be provided in <resource>:<value> format")
}
var err error
switch resourcePair[0] {
case "cpu":
cpu, err = strconv.ParseFloat(resourcePair[1], 64)
if err != nil {
return errors.Wrap(err, "unable to convert CPU value provided to a floating point number")
}
case "ram":
ram, err = strconv.ParseInt(resourcePair[1], 10, 64)
if err != nil {
return errors.Wrap(err, "unable to convert RAM value provided to a integer number")
}
case "disk":
disk, err = strconv.ParseInt(resourcePair[1], 10, 64)
if err != nil {
return errors.Wrap(err, "unable to convert DISK value provided to a integer number")
}
default:
return fmt.Errorf("unknown resource value provided, only cpu, ram, and disk are supported")
}
}
return nil
},
}
func setQuota(cmd *cobra.Command, args []string) {
log.Println("Setting Quota resources for role.")
log.Println(args)
err := client.SetQuota(*role, &cpu, &ram, &disk)
if err != nil {
log.Fatal(err)
}
}

61
cmd/simulate.go Normal file
View file

@ -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)
}

View file

@ -1,68 +1,297 @@
/**
* 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"
"encoding/json"
"errors"
"io/ioutil"
"os"
"time"
"github.com/paypal/gorealis/gen-go/apache/aurora"
"github.com/aurora-scheduler/australis/internal"
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
const countFlag = "count"
const percentageFlag = "percentage"
const jsonFlag = "json"
const jsonFileFlag = "json-file"
func init() {
rootCmd.AddCommand(startCmd)
// Sub-commands
startCmd.AddCommand(startMaintCmd)
startCmd.AddCommand(startDrainCmd.Cmd)
startDrainCmd.Cmd.Run = drain
// Maintenance specific flags
startMaintCmd.Flags().IntVar(&monitorInterval,"interval", 5, "Interval at which to poll scheduler.")
startMaintCmd.Flags().IntVar(&monitorTimeout,"timeout", 50, "Time after which the monitor will stop polling and throw an error.")
startDrainCmd.Cmd.Flags().DurationVar(&startDrainCmd.MonitorInterval, "interval", time.Second*5, "Interval at which to poll scheduler.")
startDrainCmd.Cmd.Flags().DurationVar(&startDrainCmd.MonitorTimeout, "timeout", time.Minute*10, "Time after which the monitor will stop polling and throw an error.")
startDrainCmd.Cmd.Flags().StringVar(&fromJsonFile, jsonFileFlag, "", "JSON file to read list of agents from.")
startDrainCmd.Cmd.Flags().BoolVar(&fromJson, jsonFlag, false, "Read JSON list of agents from the STDIN.")
/* SLA Aware commands */
startCmd.AddCommand(startSLADrainCmd.Cmd)
startSLADrainCmd.Cmd.Run = slaDrain
// SLA Maintenance specific flags
startSLADrainCmd.Cmd.Flags().Int64Var(&count, countFlag, 5, "Instances count that should be running to meet SLA.")
startSLADrainCmd.Cmd.Flags().Float64Var(&percent, percentageFlag, 80.0, "Percentage of instances that should be running to meet SLA.")
startSLADrainCmd.Cmd.Flags().DurationVar(&duration, "duration", time.Minute*1, "Minimum time duration a task needs to be `RUNNING` to be treated as active.")
startSLADrainCmd.Cmd.Flags().DurationVar(&forceDrainTimeout, "sla-limit", time.Minute*60, "Time limit after which SLA-Aware drain sheds SLA Awareness.")
startSLADrainCmd.Cmd.Flags().DurationVar(&startSLADrainCmd.MonitorInterval, "interval", time.Second*10, "Interval at which to poll scheduler.")
startSLADrainCmd.Cmd.Flags().DurationVar(&startSLADrainCmd.MonitorTimeout, "timeout", time.Minute*20, "Time after which the monitor will stop polling and throw an error.")
startSLADrainCmd.Cmd.Flags().StringVar(&fromJsonFile, jsonFileFlag, "", "JSON file to read list of agents from.")
startSLADrainCmd.Cmd.Flags().BoolVar(&fromJson, jsonFlag, false, "Read JSON list of agents from the STDIN.")
startCmd.AddCommand(startMaintenanceCmd.Cmd)
startMaintenanceCmd.Cmd.Run = maintenance
// SLA Maintenance specific flags
startMaintenanceCmd.Cmd.Flags().DurationVar(&startMaintenanceCmd.MonitorInterval, "interval", time.Second*5, "Interval at which to poll scheduler.")
startMaintenanceCmd.Cmd.Flags().DurationVar(&startMaintenanceCmd.MonitorTimeout, "timeout", time.Minute*10, "Time after which the monitor will stop polling and throw an error.")
startMaintenanceCmd.Cmd.Flags().StringVar(&fromJsonFile, jsonFileFlag, "", "JSON file to read list of agents from.")
startMaintenanceCmd.Cmd.Flags().BoolVar(&fromJson, jsonFlag, false, "Read JSON list of agents from the STDIN.")
// Start update command
startCmd.AddCommand(startUpdateCmd.Cmd)
startUpdateCmd.Cmd.Run = update
startUpdateCmd.Cmd.Flags().DurationVar(&startUpdateCmd.MonitorInterval, "interval", time.Second*5, "Interval at which to poll scheduler.")
startUpdateCmd.Cmd.Flags().DurationVar(&startUpdateCmd.MonitorTimeout, "timeout", time.Minute*10, "Time after which the monitor will stop polling and throw an error.")
}
var startCmd = &cobra.Command{
Use: "start",
Short: "Start a service, maintenance on a host (DRAIN), a snapshot, or a backup.",
Short: "Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.",
}
var startMaintCmd = &cobra.Command{
Use: "drain [space separated host list]",
Short: "Place a list of space separated Mesos Agents into maintenance mode.",
Long: `Adds a Mesos Agent to Aurora's Drain list. Agents in this list
var startDrainCmd = internal.MonitorCmdConfig{
Cmd: &cobra.Command{
Use: "drain [space separated host list or use JSON flags]",
Short: "Place a list of space separated Mesos Agents into draining mode.",
Long: `Adds a Mesos Agent to Aurora's Drain list. Agents in this list
are not allowed to schedule new tasks and any tasks already running on this Agent
are killed and rescheduled in an Agent that is not in maintenance mode. Command
expects a space separated list of hosts to place into maintenance mode.`,
Args: cobra.MinimumNArgs(1),
Run: drain,
Args: argsValidateJSONFlags,
},
}
var startSLADrainCmd = internal.MonitorCmdConfig{
Cmd: &cobra.Command{
Use: "sla-drain [space separated host list or use JSON flags]",
Short: "Place a list of space separated Mesos Agents into maintenance mode using SLA aware strategies.",
Long: `Adds a Mesos Agent to Aurora's Drain list. Agents in this list
are not allowed to schedule new tasks and any tasks already running on this Agent
are killed and rescheduled in an Agent that is not in maintenance mode. Command
expects a space separated list of hosts to place into maintenance mode.
If the --count argument is passed, tasks will be drained using the count SLA policy as a fallback
when a Job does not have a defined SLA policy.
If the --percentage argument is passed, tasks will be drained using the percentage SLA policy as a fallback
when a Job does not have a defined SLA policy.`,
Args: argsValidateJSONFlags,
},
}
var startMaintenanceCmd = internal.MonitorCmdConfig{
Cmd: &cobra.Command{
Use: "maintenance [space separated host list or use JSON flags]",
Short: "Place a list of space separated Mesos Agents into maintenance mode.",
Long: `Places Mesos Agent into Maintenance mode. Agents in this list
are de-prioritized for scheduling a task. Command
expects a space separated list of hosts to place into maintenance mode.`,
Args: argsValidateJSONFlags,
},
}
var startUpdateCmd = internal.MonitorCmdConfig{
Cmd: &cobra.Command{
Use: "update [update config]",
Short: "Start an update on an Aurora long running service.",
Long: `Starts the update process on an Aurora long running service. If no such service exists, the update mechanism
will act as a deployment, creating all new instances based on the requirements in the update configuration.`,
Args: cobra.ExactArgs(1),
},
}
func argsValidateJSONFlags(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed(jsonFlag) && cmd.Flags().Changed(jsonFileFlag) {
return errors.New("only json file or json stdin must be set")
}
// These two flags are mutually exclusive
if cmd.Flags().Changed(jsonFlag) != cmd.Flags().Changed(jsonFileFlag) {
return nil
}
if len(args) < 1 {
return errors.New("at least one host must be specified")
}
return nil
}
func hostList(cmd *cobra.Command, args []string) []string {
var hosts []string
if cmd.Flags().Changed(jsonFlag) {
err := json.NewDecoder(os.Stdin).Decode(&hosts)
if err != nil {
log.Fatal(err)
}
} else if cmd.Flags().Changed(jsonFileFlag) {
data, err := ioutil.ReadFile(fromJsonFile)
if err != nil {
log.Fatal(err)
}
err = json.Unmarshal(data, &hosts)
if err != nil {
log.Fatal(err)
}
} else {
hosts = args
}
return hosts
}
func drain(cmd *cobra.Command, args []string) {
fmt.Println("Setting hosts to DRAINING")
fmt.Println(args)
_, result, err := client.DrainHosts(args...)
hosts := hostList(cmd, args)
log.Infoln("Setting hosts to DRAINING")
log.Infoln(hosts)
result, err := client.DrainHosts(hosts...)
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %+v", err)
}
log.Debugln(result)
log.Infof("Monitoring for %v at %v intervals", monitorHostCmd.MonitorTimeout, monitorHostCmd.MonitorInterval)
// Monitor change to DRAINING and DRAINED mode
hostResult, err := monitor.HostMaintenance(
args,
hostResult, err := client.MonitorHostMaintenance(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED},
monitorInterval,
monitorTimeout)
startDrainCmd.MonitorInterval,
startDrainCmd.MonitorTimeout)
internal.MaintenanceMonitorPrint(hostResult, []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED}, toJson)
if err != nil {
for host, ok := range hostResult {
if !ok {
fmt.Printf("Host %s did not transtion into desired mode(s)\n", host)
}
}
fmt.Printf("error: %+v\n", err.Error())
return
log.Fatalln(err)
}
fmt.Println(result.String())
}
func slaDrainHosts(policy *aurora.SlaPolicy, interval, timeout time.Duration, hosts ...string) {
result, err := client.SLADrainHosts(policy, int64(forceDrainTimeout.Seconds()), hosts...)
if err != nil {
log.Fatalf("error: %+v", err)
}
log.Debugln(result)
log.Infof("Monitoring for %v at %v intervals", timeout, interval)
// Monitor change to DRAINING and DRAINED mode
hostResult, err := client.MonitorHostMaintenance(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED},
interval,
timeout)
internal.MaintenanceMonitorPrint(hostResult, []aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED}, toJson)
if err != nil {
log.Fatalf("error: %+v", err)
}
}
func slaDrain(cmd *cobra.Command, args []string) {
hosts := hostList(cmd, args)
// This check makes sure only a single flag is set.
// If they're both set or both not set, the statement will evaluate to true.
if cmd.Flags().Changed(percentageFlag) == cmd.Flags().Changed(countFlag) {
log.Fatal("Either percentage or count must be set exclusively.")
}
policy := &aurora.SlaPolicy{}
if cmd.Flags().Changed(percentageFlag) {
log.Infoln("Setting hosts to DRAINING with the Percentage SLA policy.")
policy.PercentageSlaPolicy = &aurora.PercentageSlaPolicy{
Percentage: percent,
DurationSecs: int64(duration.Seconds()),
}
}
if cmd.Flags().Changed(countFlag) {
log.Infoln("Setting hosts to DRAINING with the Count SLA policy.")
policy.CountSlaPolicy = &aurora.CountSlaPolicy{Count: count, DurationSecs: int64(duration.Seconds())}
}
log.Infoln("Hosts affected: ", args)
slaDrainHosts(policy, startDrainCmd.MonitorInterval, startDrainCmd.MonitorTimeout, hosts...)
}
func maintenance(cmd *cobra.Command, args []string) {
hosts := hostList(cmd, args)
log.Infoln("Setting hosts to Maintenance mode")
log.Infoln(hosts)
result, err := client.StartMaintenance(hosts...)
if err != nil {
log.Fatalf("error: %+v", err)
}
log.Debugln(result)
log.Infof("Monitoring for %v at %v intervals", monitorHostCmd.MonitorTimeout, monitorHostCmd.MonitorInterval)
// Monitor change to DRAINING and DRAINED mode
hostResult, err := client.MonitorHostMaintenance(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_SCHEDULED},
startMaintenanceCmd.MonitorInterval,
startMaintenanceCmd.MonitorTimeout)
internal.MaintenanceMonitorPrint(hostResult, []aurora.MaintenanceMode{aurora.MaintenanceMode_SCHEDULED}, toJson)
if err != nil {
log.Fatalf("error: %+v", err)
}
}
func update(cmd *cobra.Command, args []string) {
updateJob, err := internal.UnmarshalUpdate(args[0])
if err != nil {
log.Fatal(err)
}
update, err := updateJob.ToRealis()
if err != nil {
log.Fatal(err)
}
result, err := client.StartJobUpdate(update, "")
if err != nil {
log.Fatalf("Update failed to start %v", err)
}
if ok, monitorErr := client.MonitorJobUpdate(*result.GetKey(),
startUpdateCmd.MonitorInterval,
startUpdateCmd.MonitorTimeout); !ok || monitorErr != nil {
log.Fatal("update did not ROLL FORWARD before monitor timed out")
}
}

View file

@ -1,10 +1,24 @@
/**
* 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"
"os"
"time"
"github.com/paypal/gorealis/gen-go/apache/aurora"
"github.com/aurora-scheduler/australis/internal"
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/spf13/cobra"
)
@ -12,9 +26,10 @@ func init() {
rootCmd.AddCommand(stopCmd)
// Stop subcommands
stopCmd.AddCommand(stopMaintCmd)
stopMaintCmd.Flags().IntVar(&monitorInterval,"interval", 5, "Interval at which to poll scheduler.")
stopMaintCmd.Flags().IntVar(&monitorTimeout,"timeout", 50, "Time after which the monitor will stop polling and throw an error.")
stopCmd.AddCommand(stopMaintCmd.Cmd)
stopMaintCmd.Cmd.Run = endMaintenance
stopMaintCmd.Cmd.Flags().DurationVar(&stopMaintCmd.MonitorInterval, "interval", time.Second*5, "Interval at which to poll scheduler.")
stopMaintCmd.Cmd.Flags().DurationVar(&stopMaintCmd.MonitorTimeout, "timeout", time.Minute*1, "Time after which the monitor will stop polling and throw an error.")
// Stop update
@ -30,11 +45,12 @@ var stopCmd = &cobra.Command{
Short: "Stop a service or maintenance on a host (DRAIN).",
}
var stopMaintCmd = &cobra.Command{
Use: "drain [space separated host list]",
Short: "Stop maintenance on a host (move to NONE).",
Long: `Transition a list of hosts currently in a maintenance status out of it.`,
Run: endMaintenance,
var stopMaintCmd = internal.MonitorCmdConfig{
Cmd: &cobra.Command{
Use: "drain [space separated host list]",
Short: "Stop maintenance on a host (move to NONE).",
Long: `Transition a list of hosts currently in a maintenance status out of it.`,
},
}
var stopUpdateCmd = &cobra.Command{
@ -45,53 +61,44 @@ var stopUpdateCmd = &cobra.Command{
}
func endMaintenance(cmd *cobra.Command, args []string) {
fmt.Println("Setting hosts to NONE maintenance status.")
fmt.Println(args)
_, result, err := client.EndMaintenance(args...)
log.Println("Setting hosts to NONE maintenance status.")
log.Println(args)
result, err := client.EndMaintenance(args...)
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
log.Fatalf("error: %+v", err)
}
log.Debugln(result)
// Monitor change to NONE mode
hostResult, err := monitor.HostMaintenance(
hostResult, err := client.MonitorHostMaintenance(
args,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
monitorInterval,
monitorTimeout)
stopMaintCmd.MonitorInterval,
stopMaintCmd.MonitorTimeout)
internal.MaintenanceMonitorPrint(hostResult, []aurora.MaintenanceMode{aurora.MaintenanceMode_NONE}, toJson)
if err != nil {
for host, ok := range hostResult {
if !ok {
fmt.Printf("Host %s did not transtion into desired mode(s)\n", host)
}
}
fmt.Printf("error: %+v\n", err.Error())
return
log.Fatalf("error: %+v", err)
}
fmt.Println(result.String())
}
func stopUpdate(cmd *cobra.Command, args []string) {
if len(args) != 1 {
fmt.Println("Only a single update ID must be provided.")
os.Exit(1)
log.Fatalln("Only a single update ID must be provided.")
}
fmt.Printf("Stopping (aborting) update [%s/%s/%s] %s\n", *env, *role, *name, args[0])
log.Infof("Stopping (aborting) update [%s/%s/%s] %s\n", *env, *role, *name, args[0])
resp, err := client.AbortJobUpdate(aurora.JobUpdateKey{
err := client.AbortJobUpdate(aurora.JobUpdateKey{
Job: &aurora.JobKey{Environment: *env, Role: *role, Name: *name},
ID: args[0],
},
"")
if err != nil {
fmt.Println(err)
os.Exit(1)
log.Fatalln(err)
}
fmt.Println(resp.String())
}

13
deb-packaging/Dockerfile Normal file
View file

@ -0,0 +1,13 @@
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.15.2.linux-amd64.tar.gz -O /tmp/go.tar.gz
RUN tar -C /usr/local -xzf /tmp/go.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
COPY ./entrypoint.sh /
ENTRYPOINT [ "/entrypoint.sh" ]

View file

@ -0,0 +1,5 @@
#!/bin/bash
docker build . -t australis_deb_builder
docker run --rm -v $HOME/go/pkg/mod:/go/pkg/mod -v $(pwd)/..:/australis australis_deb_builder

9
deb-packaging/entrypoint.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
# 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

3
debian/australis.install vendored Normal file → Executable file
View file

@ -1,2 +1,5 @@
#!/usr/bin/dh-exec
build/australis.bash => usr/share/bash-completion/completions/australis
build/australis usr/bin
debian/etc/aurora/australis.yml etc/aurora

100
debian/changelog vendored
View file

@ -1,3 +1,103 @@
australis (1.0.5) stable; urgency=medium
* kill tasks
* fetch all aurora & mesos master nodes
-- Nhat Tan Le <maintainer@nhatle.xyz> Wed, 31 Aug 2022 15:03:24 -0700
australis (1.0.4) stable; urgency=medium
* fetch free capacity
* simulate task fitting - compute how many tasks can be fit in the remaining capacity
-- Nhat Tan Le <maintainer@nhatle.xyz> Tue, 2 Aug 2022 16:19:24 -0700
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 <maintainer@nhatle.xyz> 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
-- Renan Del Valle <maintainer@ridv.xyz> 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.
-- Renan Del Valle <maintainer@ridv.xyz> Wed, 30 Sep 2020 16:46:56 -0700
australis (1.0.0) stable; urgency=medium
* First stable release.
-- Renan Del Valle <maintainer@ridv.xyz> 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 <maintainer@ridv.xyz> Thu, 07 May 2020 12:00:00 -0700
australis (0.1.1) unstable; urgency=medium
* Removed support for building with dep
* Upgraded depdencies to their latest versions.
* gorealis v2 now lives in the aurora-scheduler organization and dependencies have been updated to reflect that.
-- Renan DelValle <renanidelvalle@gmail.com> Mon, 19 Feb 2020 12:00:00 -0700
australis (0.1.0) unstable; urgency=medium
* Adding support for drain sub-command to take in JSON list from stdin or from a specified file.
* Added flags json-file and json to drain, maintenance, and sla-drain.
-- Renan DelValle <renanidelvalle@gmail.com> Mon, 10 Feb 2020 12:00:00 -0700
australis (0.0.9) unstable; urgency=medium
* added ability to create jobs which contain an executorless docker container.
* sla-aware draining sub-command has been simplified. instead of having a count/percentage
subcommand, it now has a flag for each of these options. the count and percentage flag are
mutually exclusive, and one of them has to be set.
-- Renan DelValle <renanidelvalle@gmail.com> Wed, 29 Jan 2020 15:10:00 -0700
australis (0.0.8) unstable; urgency=medium
* Upgraded default timeouts and durations for sla-aware draining.
* Added ability for controlling when an SLA-Aware drain sheds
SLA awareness for SLA-aware drain policies
* Added monitor verb along with hosts noun.
* Fixed bug with monitor not using the correct default values
for sla-aware drain policies.
-- Renan DelValle <renanidelvalle@gmail.com> Fri, 25 Mar 2019 15:10:00 -0700
australis (0.0.7) unstable; urgency=medium
* Upgraded australis to gorealis v2.
* Implemented first version of create feature which takes in a YAML file.
* Added new noun to fetch status called task. Task also has two subcommands, status and config.
-- Renan DelValle <renanidelvalle@gmail.com> Wed, 26 Dec 2018 15:10:00 -0700
australis (0.0.6) unstable; urgency=medium
* Added auto-completion to the deb file.
* Added set verb and quota noun to set quota resource for certain roles.
* Added JSON output as an option for all commands.
-- Renan DelValle <renanidelvalle@gmail.com> Wed, 05 Dec 2018 15:10:00 -0700
australis (0.0.5) unstable; urgency=medium
* Backup and snapshot commands have now been moved to under the force subcommand as these are expensive operations

4
debian/control vendored
View file

@ -3,8 +3,8 @@ Priority: optional
Maintainer: Renan DelValle <renanidelvalle@gmail.com>
Section: utils
Standards-Version: 4.2.1.3
Homepage: https://github.com/rdelval/australis
Homepage: https://github.com/aurora-scheduler/australis
Package: australis
Architecture: any
Description: A gorealis based client for Apache Aurora
Description: Gorealis based command line interface client for Apache Aurora

8
debian/rules vendored
View file

@ -8,7 +8,13 @@
clean:
rm -rf $(CURDIR)/build
rm -rf $(CURDIR)/debian/asutralis
rm -rf $(CURDIR)/debian/australis.debhelper.log
rm -rf $(CURDIR)/debian/debhelper-build-stamp
rm -rf $(CURDIR)/debian/files
rm -rf $(CURDIR)/debian/australis.substvars
override_dh_auto_build:
mkdir $(CURDIR)/build
docker run --rm -v "$(CURDIR)":/go/src/github.com/rdelval/australis -w /go/src/github.com/rdelval/australis golang:1.11 go build -o build/australis
/usr/local/go/bin/go build -o build/australis
build/australis autocomplete --filename=build/australis.bash

44
docs/australis.md Normal file
View file

@ -0,0 +1,44 @@
## australis
australis is a client for Apache Aurora
### Synopsis
A light-weight command line client for use with Apache Aurora built using gorealis.
### Options
```
-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")
-h, --help help for australis
-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 create](australis_create.md) - Create an Aurora Job
* [australis fetch](australis_fetch.md) - Fetch information from Aurora
* [australis force](australis_force.md) - Force the scheduler to do a snapshot, a backup, or a task reconciliation.
* [australis kill](australis_kill.md) - Kill an Aurora Job
* [australis monitor](australis_monitor.md) - Watch for a specific state change
* [australis pulse](australis_pulse.md) - Pulse a Job update
* [australis restart](australis_restart.md) - Restart an Aurora Job.
* [australis resume](australis_resume.md) - Resume a Job update
* [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 8-Sep-2022

View file

@ -0,0 +1,47 @@
## australis autocomplete
Create auto completion for bash.
### Synopsis
Create auto completion bash file for australis. Auto completion file must be placed in the correct
directory in order for bash to pick up the definitions.
Copy australis.completion.sh into the correct folder and rename to australis
In Linux, this directory is usually /etc/bash_completion.d/
In MacOS this directory is $(brew --prefix)/etc/bash_completion.d if auto completion was install through brew.
```
australis autocomplete [flags]
```
### Options
```
--filename string Path and name of the autocompletion file. (default "australis.completion.sh")
-h, --help help for autocomplete
```
### 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](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 22-Mar-2019

41
docs/australis_create.md Normal file
View file

@ -0,0 +1,41 @@
## australis create
Create an Aurora Job
### Synopsis
Create an Aurora Job
```
australis create [flags]
```
### Options
```
-h, --help help for create
-m, --monitor monitor the result after sending the command (default true)
```
### 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
###### Auto generated by spf13/cobra on 8-Sep-2022

39
docs/australis_docs.md Normal file
View file

@ -0,0 +1,39 @@
## australis docs
Kill an Aurora Job
### Synopsis
Kill an Aurora Job
```
australis docs [flags]
```
### Options
```
-h, --help help for docs
```
### 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](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 22-Mar-2019

45
docs/australis_fetch.md Normal file
View file

@ -0,0 +1,45 @@
## australis fetch
Fetch information from Aurora
### Synopsis
Fetch information from Aurora
### Options
```
-h, --help help for fetch
```
### 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 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 8-Sep-2022

View file

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

View file

@ -0,0 +1,41 @@
## australis fetch jobs
Fetch a list of task Aurora running under a role.
### Synopsis
To be written.
```
australis fetch jobs [flags]
```
### Options
```
-h, --help help for jobs
-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 fetch](australis_fetch.md) - Fetch information from Aurora
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,38 @@
## australis fetch task
Task information from Aurora
### Synopsis
Task information from Aurora
### Options
```
-h, --help help for task
```
### 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 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 8-Sep-2022

View file

@ -0,0 +1,43 @@
## australis fetch task config
Fetch a list of task configurations from Aurora.
### Synopsis
To be written.
```
australis fetch task config [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for config
-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 fetch task](australis_fetch_task.md) - Task information from Aurora
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,43 @@
## australis fetch task status
Fetch task status for a Job key.
### Synopsis
To be written.
```
australis fetch task status [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for status
-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 fetch task](australis_fetch_task.md) - Task information from Aurora
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

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

39
docs/australis_force.md Normal file
View file

@ -0,0 +1,39 @@
## australis force
Force the scheduler to do a snapshot, a backup, or a task reconciliation.
### Synopsis
Force the scheduler to do a snapshot, a backup, or a task reconciliation.
### Options
```
-h, --help help for force
```
### 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 force backup](australis_force_backup.md) - Force the leading scheduler to perform a Backup.
* [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 8-Sep-2022

View file

@ -0,0 +1,41 @@
## australis force backup
Force the leading scheduler to perform a Backup.
### Synopsis
Force the Aurora Scheduler to write a backup of the latest snapshot to the filesystem
of the leading scheduler.
```
australis force backup [flags]
```
### Options
```
-h, --help help for backup
```
### 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 force](australis_force.md) - Force the scheduler to do a snapshot, a backup, or a task reconciliation.
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,45 @@
## australis force recon
Force the leading scheduler to perform a reconciliation.
### Synopsis
Force the Aurora Scheduler to perform a task reconciliation.
Explicit Recon:
Aurora will send a list of non-terminal task IDs and the master responds
with the latest state for each task, if possible.
Implicit Recon:
Aurora will send an empty list of tasks and the master responds with the latest
state for all currently known non-terminal tasks.
### Options
```
-h, --help help for recon
```
### 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 force](australis_force.md) - Force the scheduler to do a snapshot, a backup, or a task reconciliation.
* [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 8-Sep-2022

View file

@ -0,0 +1,42 @@
## australis force recon explicit
Force the leading scheduler to perform an explicit recon.
### Synopsis
Aurora will send a list of non-terminal task IDs and the master
responds with the latest state for each task, if possible.
```
australis force recon explicit [batch_size] [flags]
```
### Options
```
-h, --help help for explicit
```
### 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 force recon](australis_force_recon.md) - Force the leading scheduler to perform a reconciliation.
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,41 @@
## australis force recon implicit
Force the leading scheduler to perform an implicit recon.
### Synopsis
Forces leading scheduler to ask Mesos Master for a list of the latest state for
all currently known non-terminal tasks being run by Aurora.
```
australis force recon implicit [flags]
```
### Options
```
-h, --help help for implicit
```
### 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 force recon](australis_force_recon.md) - Force the leading scheduler to perform a reconciliation.
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,41 @@
## australis force snapshot
Force the leading scheduler to perform a Snapshot.
### Synopsis
Takes a Snapshot of the in memory state of the Apache Aurora cluster and
writes it to the Mesos replicated log. This should NOT be confused with a backup.
```
australis force snapshot [flags]
```
### Options
```
-h, --help help for snapshot
```
### 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 force](australis_force.md) - Force the scheduler to do a snapshot, a backup, or a task reconciliation.
###### Auto generated by spf13/cobra on 8-Sep-2022

38
docs/australis_kill.md Normal file
View file

@ -0,0 +1,38 @@
## australis kill
Kill an Aurora Job
### Synopsis
Kill an Aurora Job
### Options
```
-h, --help help for kill
```
### 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 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 8-Sep-2022

View file

@ -0,0 +1,44 @@
## australis kill job
Kill an Aurora Job
### Synopsis
Kill an Aurora Job
```
australis kill job [flags]
```
### Options
```
-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
```
### Options inherited from parent commands
```
-a, --caCertsPath string Path where CA certificates can be found.
-c, --clientCert string Client certificate to use to connect to Aurora.
-k, --clientKey string Client key to use to connect to Aurora.
--config string Config file to use. (default "/etc/aurora/australis.yml")
-l, --logLevel string Set logging level [panic fatal error warning info debug trace]. (default "info")
-p, --password string Password to use for API authentication
-s, --scheduler_addr string Aurora Scheduler's address.
-i, --skipCertVerification Skip CA certificate hostname verification.
-t, --timeout duration Gorealis timeout. (default 20s)
--toJSON Print output in JSON format.
-u, --username string Username to use for API authentication
-z, --zookeeper string Zookeeper node(s) where Aurora stores information. (comma separated list)
```
### SEE ALSO
* [australis kill](australis_kill.md) - Kill an Aurora Job
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -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

37
docs/australis_monitor.md Normal file
View file

@ -0,0 +1,37 @@
## australis monitor
Watch for a specific state change
### Synopsis
Watch for a specific state change
### Options
```
-h, --help help for monitor
```
### 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 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 8-Sep-2022

View file

@ -0,0 +1,43 @@
## australis monitor hosts
Watch a host maintenance status until it enters one of the desired statuses.
### Synopsis
Provide a list of hosts to monitor for desired statuses. Statuses may be passed using the --statuses
flag with a list of comma separated statuses. Statuses include [NONE, SCHEDULED, DRAINED, DRAINING]
```
australis monitor hosts [flags]
```
### Options
```
-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])
```
### 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 monitor](australis_monitor.md) - Watch for a specific state change
###### Auto generated by spf13/cobra on 8-Sep-2022

44
docs/australis_pulse.md Normal file
View file

@ -0,0 +1,44 @@
## australis pulse
Pulse a Job update
### Synopsis
Pulse a Job update
```
australis pulse [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for pulse
--id string Update ID
-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](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 8-Sep-2022

37
docs/australis_restart.md Normal file
View file

@ -0,0 +1,37 @@
## australis restart
Restart an Aurora Job.
### Synopsis
Restart an Aurora Job.
### Options
```
-h, --help help for restart
```
### 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 restart job](australis_restart_job.md) - Restart a Job.
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,43 @@
## australis restart job
Restart a Job.
### Synopsis
Restart a Job.
```
australis restart job [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for job
-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 8-Sep-2022

View file

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

45
docs/australis_resume.md Normal file
View file

@ -0,0 +1,45 @@
## australis resume
Resume a Job update
### Synopsis
Resume a Job update
```
australis resume [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for resume
--id string Update ID
--message string Message to store along resume.
-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](australis.md) - australis is a client for Apache Aurora
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,37 @@
## australis rollback
Rollback an operation such as an Update
### Synopsis
Rollback an operation such as an Update
### Options
```
-h, --help help for rollback
```
### 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 rollback update](australis_rollback_update.md) - Rollback an update
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,45 @@
## australis rollback update
Rollback an update
### Synopsis
Rollback an update
```
australis rollback update [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for update
--id string Update ID
--message string Message to store alongside resume event
-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 rollback](australis_rollback.md) - Rollback an operation such as an Update
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,40 @@
## australis schedule
Schedule a cron job on Aurora scheduler
### Synopsis
Schedule a cron job on Aurora scheduler
```
australis schedule [flags]
```
### Options
```
-h, --help help for schedule
```
### 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
###### Auto generated by spf13/cobra on 8-Sep-2022

37
docs/australis_set.md Normal file
View file

@ -0,0 +1,37 @@
## australis set
Set a value in the Aurora Scheduler.
### Synopsis
Set a value in the Aurora Scheduler.
### Options
```
-h, --help help for set
```
### 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 set quota](australis_set_quota.md) - Set Quota resources for a role.
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,40 @@
## australis set quota
Set Quota resources for a role.
### Synopsis
Quotas can be set for roles in Aurora. Using this command we can set the resources reserved a role.
```
australis set quota <role> cpu:<value> ram:<value> disk:<value> [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 set](australis_set.md) - Set a value in the Aurora Scheduler.
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

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

View file

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

40
docs/australis_start.md Normal file
View file

@ -0,0 +1,40 @@
## australis start
Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
### Synopsis
Start a service, maintenance on a host (DRAIN), a snapshot, an update, or a backup.
### Options
```
-h, --help help for start
```
### 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 start drain](australis_start_drain.md) - Place a list of space separated Mesos Agents into draining mode.
* [australis start maintenance](australis_start_maintenance.md) - Place a list of space separated Mesos Agents into maintenance mode.
* [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 8-Sep-2022

View file

@ -0,0 +1,46 @@
## australis start drain
Place a list of space separated Mesos Agents into draining mode.
### Synopsis
Adds a Mesos Agent to Aurora's Drain list. Agents in this list
are not allowed to schedule new tasks and any tasks already running on this Agent
are killed and rescheduled in an Agent that is not in maintenance mode. Command
expects a space separated list of hosts to place into maintenance mode.
```
australis start drain [space separated host list or use JSON flags] [flags]
```
### Options
```
-h, --help help for drain
--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.
```
### 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 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 8-Sep-2022

View file

@ -0,0 +1,45 @@
## australis start maintenance
Place a list of space separated Mesos Agents into maintenance mode.
### Synopsis
Places Mesos Agent into Maintenance mode. Agents in this list
are de-prioritized for scheduling a task. Command
expects a space separated list of hosts to place into maintenance mode.
```
australis start maintenance [space separated host list or use JSON flags] [flags]
```
### Options
```
-h, --help help for maintenance
--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.
```
### 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 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 8-Sep-2022

View file

@ -0,0 +1,54 @@
## australis start sla-drain
Place a list of space separated Mesos Agents into maintenance mode using SLA aware strategies.
### Synopsis
Adds a Mesos Agent to Aurora's Drain list. Agents in this list
are not allowed to schedule new tasks and any tasks already running on this Agent
are killed and rescheduled in an Agent that is not in maintenance mode. Command
expects a space separated list of hosts to place into maintenance mode.
If the --count argument is passed, tasks will be drained using the count SLA policy as a fallback
when a Job does not have a defined SLA policy.
If the --percentage argument is passed, 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 [space separated host list or use JSON flags] [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 1m0s)
-h, --help help for sla-drain
--interval duration Interval at which to poll scheduler. (default 10s)
--json Read JSON list of agents from the STDIN.
--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)
```
### 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 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 8-Sep-2022

View file

@ -0,0 +1,42 @@
## australis start update
Start an update on an Aurora long running service.
### Synopsis
Starts the update process on an Aurora long running service. If no such service exists, the update mechanism
will act as a deployment, creating all new instances based on the requirements in the update configuration.
```
australis start update [update config] [flags]
```
### Options
```
-h, --help help for update
--interval duration Interval at which to poll scheduler. (default 5s)
```
### 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 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 8-Sep-2022

38
docs/australis_stop.md Normal file
View file

@ -0,0 +1,38 @@
## australis stop
Stop a service or maintenance on a host (DRAIN).
### Synopsis
Stop a service or maintenance on a host (DRAIN).
### Options
```
-h, --help help for stop
```
### 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 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 8-Sep-2022

View file

@ -0,0 +1,41 @@
## australis stop drain
Stop maintenance on a host (move to NONE).
### Synopsis
Transition a list of hosts currently in a maintenance status out of it.
```
australis stop drain [space separated host list] [flags]
```
### Options
```
-h, --help help for drain
--interval duration Interval at which to poll scheduler. (default 5s)
```
### 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 stop](australis_stop.md) - Stop a service or maintenance on a host (DRAIN).
###### Auto generated by spf13/cobra on 8-Sep-2022

View file

@ -0,0 +1,43 @@
## australis stop update
Stop update
### Synopsis
To be written.
```
australis stop update [update ID] [flags]
```
### Options
```
-e, --environment string Aurora Environment
-h, --help help for update
-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 stop](australis_stop.md) - Stop a service or maintenance on a host (DRAIN).
###### Auto generated by spf13/cobra on 8-Sep-2022

16
go.mod Normal file
View file

@ -0,0 +1,16 @@
module github.com/aurora-scheduler/australis
go 1.15
require (
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
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.3
github.com/stretchr/testify v1.5.0
gopkg.in/yaml.v2 v2.2.8
)
replace github.com/apache/thrift v0.13.0 => github.com/ridv/thrift v0.13.2

12
hello_world_docker.yaml Normal file
View file

@ -0,0 +1,12 @@
---
environment: "prod"
role: "vagrant"
name: "cryptography"
cpu: 2.00
ram: 256
disk: 128
instances: 1
container:
docker:
name: "rdelvalle/phoronix"
tag: cryptography

216
internal/job.go Normal file
View file

@ -0,0 +1,216 @@
/**
* 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 internal
import (
"errors"
"strings"
realis "github.com/aurora-scheduler/gorealis/v2"
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
)
type URI struct {
URI string `yaml:"uri"`
Extract bool `yaml:"extract"`
Cache bool `yaml:"cache"`
}
type Executor struct {
Name string `yaml:"name"`
Data string `yaml:"data"`
}
type ThermosProcess struct {
Name string `yaml:"name"`
Cmd string `yaml:"cmd"`
}
type DockerContainer struct {
Name string `yaml:"name"`
Tag string `yaml:"tag"`
}
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"`
Name string `yaml:"name"`
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"`
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"`
CronCollisionPolicy *string `yaml:"cronCollisionPolicy,omitempty"`
ValueConstraints []ValueConstraint `yaml:"valueConstraints,flow,omitempty"`
LimitConstraints []LimitConstraint `yaml:"limitConstraints,flow,omitempty"`
}
func (j *Job) ToRealis() (*realis.AuroraJob, error) {
auroraJob := realis.NewJob().
Environment(j.Environment).
Role(j.Role).
Name(j.Name).
CPU(j.CPU).
RAM(j.RAM).
Disk(j.Disk).
AddPorts(int(j.Port)).
IsService(j.Service).
Tier(j.Tier).
Priority(j.Priority).
Production(j.Production).
InstanceCount(j.Instances).
MaxFailure(j.MaxFailures)
if j.GPU > 0 {
auroraJob.GPU(j.GPU)
}
if j.CronSchedule != nil {
auroraJob.CronSchedule(*j.CronSchedule)
}
if j.CronCollisionPolicy != nil {
// Ignoring error because we have already checked for it in the validate function
policy, _ := aurora.CronCollisionPolicyFromString(*j.CronCollisionPolicy)
auroraJob.CronCollisionPolicy(policy)
}
// Adding URIs.
for _, uri := range j.URIs {
auroraJob.AddURIs(uri.Extract, uri.Cache, uri.URI)
}
// Adding Metadata.
for key, value := range j.Metadata {
auroraJob.AddLabel(key, value)
}
// If thermos jobs processes are provided, use them
if len(j.Thermos) > 0 {
thermosExec := realis.ThermosExecutor{}
for _, process := range j.Thermos {
thermosExec.AddProcess(realis.NewThermosProcess(process.Name, process.Cmd))
}
auroraJob.ThermosExecutor(thermosExec)
} else if j.Executor.Name != "" {
// Non-Thermos executor
if j.Executor.Name == "" {
return nil, errors.New("no executor name provided")
}
auroraJob.ExecutorName(j.Executor.Name)
auroraJob.ExecutorData(j.Executor.Data)
} else if j.Container != nil {
if j.Container.Docker == nil {
return nil, errors.New("no container specified")
}
if j.Container.Docker.Tag != "" && !strings.ContainsRune(j.Container.Docker.Name, ':') {
j.Container.Docker.Name += ":" + j.Container.Docker.Tag
}
auroraJob.Container(realis.NewDockerContainer().Image(j.Container.Docker.Name))
}
// 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
}
func (j *Job) Validate() error {
if j.Name == "" {
return errors.New("job name not specified")
}
if j.Role == "" {
return errors.New("job role not specified")
}
if j.Environment == "" {
return errors.New("job environment not specified")
}
if j.Instances <= 0 {
return errors.New("number of instances in job cannot be less than or equal to 0")
}
if j.CPU <= 0.0 {
return errors.New("CPU must be greater than 0")
}
if j.RAM <= 0 {
return errors.New("RAM must be greater than 0")
}
if j.Disk <= 0 {
return errors.New("disk must be greater than 0")
}
if len(j.Thermos) == 0 && j.Executor.Name == "" && j.Container == nil {
return errors.New("task does not contain a thermos definition, a custom executor name, or a container to launch")
}
return nil
}
func (j *Job) ValidateCron() error {
if j.CronSchedule == nil {
return errors.New("cron schedule must be set")
}
if j.CronCollisionPolicy != nil {
if _, err := aurora.CronCollisionPolicyFromString(*j.CronCollisionPolicy); err != nil {
return err
}
} else {
killExisting := aurora.CronCollisionPolicy_KILL_EXISTING.String()
j.CronCollisionPolicy = &killExisting
}
return nil
}

128
internal/updateJob.go Normal file
View file

@ -0,0 +1,128 @@
/**
* 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 internal
import (
"errors"
"fmt"
"time"
realis "github.com/aurora-scheduler/gorealis/v2"
)
type InstanceRange struct {
First int32 `yaml:"first"`
Last int32 `yaml:"last"`
}
type VariableBatchStrategy struct {
GroupSizes []int32 `yaml:"groupSizes"`
AutoPause bool `yaml:"autoPause"`
}
type BatchStrategy struct {
GroupSize int32 `yaml:"groupSize"`
AutoPause bool `yaml:"autoPause"`
}
type QueueStrategy struct {
GroupSize int32 `yaml:"groupSize"`
}
type UpdateStrategy struct {
VariableBatch *VariableBatchStrategy `yaml:"variableBatch"`
Batch *BatchStrategy `yaml:"batch"`
Queue *QueueStrategy `yaml:"queue"`
}
type UpdateSettings struct {
MaxPerInstanceFailures int32 `yaml:"maxPerInstanceFailures"`
MaxFailedInstances int32 `yaml:"maxFailedInstances"`
MinTimeInRunning time.Duration `yaml:"minTimeInRunning"`
RollbackOnFailure bool `yaml:"rollbackOnFailure"`
InstanceRanges []InstanceRange `yaml:"instanceRanges"`
InstanceCount int32 `yaml:"instanceCount"`
PulseTimeout time.Duration `yaml:"pulseTimeout"`
SLAAware bool `yaml:"slaAware"`
Strategy UpdateStrategy `yaml:"strategy"`
}
func (u *UpdateSettings) Validate() error {
if u.InstanceCount <= 0 {
return errors.New("instance count must be larger than 0")
}
if u.Strategy.VariableBatch != nil {
if len(u.Strategy.VariableBatch.GroupSizes) == 0 {
return errors.New("variable batch strategy must specify at least one batch size")
}
for _, batch := range u.Strategy.VariableBatch.GroupSizes {
if batch <= 0 {
return errors.New("all groups in a variable batch strategy must be larger than 0")
}
}
} else if u.Strategy.Batch != nil {
if u.Strategy.Batch.GroupSize <= 0 {
return errors.New("batch strategy must specify a group larger than 0")
}
} else if u.Strategy.Queue != nil {
if u.Strategy.Queue.GroupSize <= 0 {
return errors.New("queue strategy must specify a group larger than 0")
}
} else {
log.Info("No strategy set, falling back on queue strategy with a group size 1")
}
return nil
}
type UpdateJob struct {
JobConfig Job `yaml:"jobConfig"`
UpdateSettings UpdateSettings `yaml:"updateSettings"`
}
func (u *UpdateJob) ToRealis() (*realis.JobUpdate, error) {
jobConfig, err := u.JobConfig.ToRealis()
if err != nil {
return nil, fmt.Errorf("invalid job configuration %w", err)
}
update := realis.JobUpdateFromAuroraTask(jobConfig.AuroraTask())
update.MaxPerInstanceFailures(u.UpdateSettings.MaxPerInstanceFailures).
MaxFailedInstances(u.UpdateSettings.MaxFailedInstances).
WatchTime(u.UpdateSettings.MinTimeInRunning).
RollbackOnFail(u.UpdateSettings.RollbackOnFailure).
PulseIntervalTimeout(u.UpdateSettings.PulseTimeout).
SlaAware(u.UpdateSettings.SLAAware).
InstanceCount(u.UpdateSettings.InstanceCount)
strategy := u.UpdateSettings.Strategy
switch {
case strategy.VariableBatch != nil:
update.VariableBatchStrategy(strategy.VariableBatch.AutoPause, strategy.VariableBatch.GroupSizes...)
case strategy.Batch != nil:
update.BatchUpdateStrategy(strategy.Batch.AutoPause, strategy.Batch.GroupSize)
case strategy.Queue != nil:
update.QueueUpdateStrategy(strategy.Queue.GroupSize)
default:
update.QueueUpdateStrategy(1)
}
for _, r := range u.UpdateSettings.InstanceRanges {
update.AddInstanceRange(r.First, r.Last)
}
return update, nil
}

161
internal/util.go Normal file
View file

@ -0,0 +1,161 @@
/**
* 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 internal
import (
"bytes"
"encoding/json"
"fmt"
"os"
"time"
"github.com/aurora-scheduler/gorealis/v2/gen-go/apache/aurora"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
yaml "gopkg.in/yaml.v2"
)
type MonitorCmdConfig struct {
Cmd *cobra.Command
MonitorInterval, MonitorTimeout time.Duration
StatusList []string
}
var log *logrus.Logger
// Logger sets the logger available to the internal package
func Logger(l *logrus.Logger) {
log = l
}
// ToJSON converts an interface to a JSON formatted string
func ToJSON(v interface{}) string {
output, err := json.Marshal(v)
if err != nil {
log.Fatalf("Unable to serialize Aurora response: %+v", v)
}
return string(output)
}
func GetLoggingLevels() string {
var buffer bytes.Buffer
for _, level := range logrus.AllLevels {
buffer.WriteString(level.String())
buffer.WriteString(" ")
}
buffer.Truncate(buffer.Len() - 1)
return buffer.String()
}
func MaintenanceMonitorPrint(hostResult map[string]bool, desiredStates []aurora.MaintenanceMode, toJson bool) {
if len(hostResult) > 0 {
// Create anonymous struct for JSON formatting
output := struct {
DesiredStates []string `json:"desired_states"`
Transitioned []string `json:"transitioned"`
NonTransitioned []string `json:"non-transitioned"`
}{
make([]string, 0),
make([]string, 0),
make([]string, 0),
}
for _, state := range desiredStates {
output.DesiredStates = append(output.DesiredStates, state.String())
}
for host, ok := range hostResult {
if ok {
output.Transitioned = append(output.Transitioned, host)
} else {
output.NonTransitioned = append(output.NonTransitioned, host)
}
}
if toJson {
fmt.Println(ToJSON(output))
} else {
fmt.Printf("Entered %v status: %v\n", output.DesiredStates, output.Transitioned)
fmt.Printf("Did not enter %v status: %v\n", output.DesiredStates, output.NonTransitioned)
}
}
}
func UnmarshalJob(filename string) (Job, error) {
job := Job{}
if jobsFile, err := os.Open(filename); err != nil {
return job, errors.Wrap(err, "unable to read the job config file")
} else {
if err := yaml.NewDecoder(jobsFile).Decode(&job); err != nil {
return job, errors.Wrap(err, "unable to parse job config file")
}
if err := job.Validate(); err != nil {
return job, fmt.Errorf("invalid job config %w", err)
}
}
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{}
if jobsFile, err := os.Open(filename); err != nil {
return updateJob, errors.Wrap(err, "unable to read the job config file")
} else {
if err := yaml.NewDecoder(jobsFile).Decode(&updateJob); err != nil {
return updateJob, errors.Wrap(err, "unable to parse job config file")
}
if err := updateJob.JobConfig.Validate(); err != nil {
return updateJob, fmt.Errorf("invalid job config %w", err)
}
if err := updateJob.UpdateSettings.Validate(); err != nil {
return updateJob, fmt.Errorf("invalid update configuration %w", err)
}
}
return updateJob, nil
}

View file

@ -12,27 +12,31 @@
* limitations under the License.
*/
package realis_test
package internal
import (
"fmt"
"testing"
"github.com/paypal/gorealis"
"github.com/stretchr/testify/assert"
)
func TestLoadClusters(t *testing.T) {
clusters, err := realis.LoadClusters("examples/clusters.json")
if err != nil {
fmt.Print(err)
}
assert.Equal(t, clusters["devcluster"].Name, "devcluster")
assert.Equal(t, clusters["devcluster"].ZK, "192.168.33.7")
assert.Equal(t, clusters["devcluster"].SchedZKPath, "/aurora/scheduler")
assert.Equal(t, clusters["devcluster"].AuthMechanism, "UNAUTHENTICATED")
assert.Equal(t, clusters["devcluster"].AgentRunDir, "latest")
assert.Equal(t, clusters["devcluster"].AgentRoot, "/var/lib/mesos")
func TestUnmarshalJob(t *testing.T) {
_, err := UnmarshalJob("../test/hello_world.yaml")
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)
assert.NoError(t, cron.ValidateCron())
}
func TestUnmarshalUpdate(t *testing.T) {
_, err := UnmarshalUpdate("../test/update_hello_world.yaml")
assert.NoError(t, err)
}

16
main.go
View file

@ -1,7 +1,21 @@
/**
* 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 main
import (
"github.com/rdelval/australis/cmd"
"github.com/aurora-scheduler/australis/cmd"
)
func main() {

26
test/hello_world.yaml Normal file
View file

@ -0,0 +1,26 @@
---
environment: "prod"
role: "vagrant"
name: "hello_world"
cpu: 0.09
ram: 64
disk: 128
instances: 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:
- start: 1
end: 4
blockIfNoPulseAfter: 1m
slaAware: false
strategy:
name: Batch
groupSize: 2

View file

@ -0,0 +1,15 @@
---
environment: "prod"
role: "vagrant"
name: "hello_world"
cpu: 0.09
ram: 64
disk: 128
instances: 1
cronSchedule: "*/1 * * * *"
cronCollisionPolicy: "CANCEL_NEW"
thermos:
- name: "bootstrap"
cmd: "echo bootstrapping"
- name: "hello_gorealis"
cmd: "echo hello world from gorealis; sleep 10;"

View file

@ -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

20
test/task_config.yaml Normal file
View file

@ -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"

View file

@ -0,0 +1,29 @@
---
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
instanceCount: 1
instanceRanges:
- first: 1
last: 4
pulseTimeout: 1m
strategy:
variableBatch:
groupSizes: [1,2,3]
autoPause: true

View file

@ -1,56 +0,0 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: false
ColumnLimit: 100
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerAlignment: false
IndentCaseLabels: false
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: true
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 190
PenaltyBreakComment: 300
PenaltyBreakString: 10000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 1200
PointerAlignment: Left
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: true
Standard: Auto
IndentWidth: 2
TabWidth: 4
UseTab: Never
BreakBeforeBraces: Attach
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
DisableFormat: false
...

View file

@ -1 +0,0 @@
.git/

View file

@ -1,112 +0,0 @@
#
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. The ASF licenses this file
## to you 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.
##
#
# EditorConfig: http://editorconfig.org
# see doc/coding_standards.md
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
# ActionScript
# [*.as]
# C
# [*.c]
# C++
[*.cpp]
indent_style = space
indent_size = 2
# C-Sharp
# [*.cs]
# D
# [*.d]
# Erlang
# [*.erl]
# Go-lang
[*.go]
indent_style = tab
indent_size = 8
# C header files
# [*.h]
# Haskell
# [*.hs]
# Haxe
# [*.hx]
# Java
# [*.java]
# Javascript
[*.js]
indent_style = space
indent_size = 2
# JSON
[*.json]
indent_style = space
indent_size = 2
# Lua
# [*.lua]
[*.markdown]
indent_style = space
trim_trailing_whitespace = false
[*.md]
indent_style = space
trim_trailing_whitespace = false
# OCaml
# [*.ml]
# Delphi Pascal
# [*.pas]
# PHP
# [*.php]
# Perl
# [*.pm]
# Python
# [*.py]
# Ruby
# [*.rb]
# Typescript
# [*.ts]
# XML
# [*.xml]

View file

@ -1 +0,0 @@
* text=auto

View file

@ -1,326 +0,0 @@
# generic ignores
*.la
*.lo
*.o
*.deps
*.dirstamp
*.libs
*.log
*.trs
*.suo
*.pyc
*.cache
*.user
*.ipch
*.sdf
*.jar
*.exe
*.dll
*_ReSharper*
*.opensdf
*.swp
*.hi
*~
.*project
junit*.properties
.idea
gen-*
Makefile
Makefile.in
aclocal.m4
acinclude.m4
autom4te.cache
cmake-*
node_modules
compile
test-driver
erl_crash.dump
.sonar
.DS_Store
.svn
.vagrant
/contrib/.vagrant/
/aclocal/libtool.m4
/aclocal/lt*.m4
/autoscan.log
/autoscan-*.log
/cmake_*
/compiler/cpp/compiler.VC.db
/compiler/cpp/compiler.VC.VC.opendb
/compiler/cpp/test/plugin/t_cpp_generator.cc
/compiler/cpp/src/thrift/plugin/plugin_constants.cpp
/compiler/cpp/src/thrift/plugin/plugin_constants.h
/compiler/cpp/src/thrift/plugin/plugin_types.cpp
/compiler/cpp/src/thrift/plugin/plugin_types.h
/compiler/cpp/test/*test
/compiler/cpp/test/thrift-gen-*
/compiler/cpp/src/thrift/thrift-bootstrap
/compiler/cpp/src/thrift/plugin/gen.stamp
/compiler/cpp/Debug
/compiler/cpp/Release
/compiler/cpp/src/thrift/libparse.a
/compiler/cpp/src/thrift/thriftl.cc
/compiler/cpp/src/thrift/thrifty.cc
/compiler/cpp/src/thrift/thrifty.hh
/compiler/cpp/src/thrift/windows/version.h
/compiler/cpp/thrift
/compiler/cpp/thriftl.cc
/compiler/cpp/thrifty.cc
/compiler/cpp/lex.yythriftl.cc
/compiler/cpp/thrifty.h
/compiler/cpp/thrifty.hh
/compiler/cpp/src/thrift/version.h
/config.*
/configure
/configure.lineno
/configure.scan
/contrib/fb303/config.cache
/contrib/fb303/config.log
/contrib/fb303/config.status
/contrib/fb303/configure
/contrib/fb303/cpp/libfb303.a
/contrib/fb303/java/build/
/contrib/fb303/py/build/
/contrib/fb303/py/fb303/FacebookService-remote
/contrib/fb303/py/fb303/FacebookService.py
/contrib/fb303/py/fb303/__init__.py
/contrib/fb303/py/fb303/constants.py
/contrib/fb303/py/fb303/ttypes.py
/depcomp
/install-sh
/lib/cpp/Debug/
/lib/cpp/Debug-mt/
/lib/cpp/Release/
/lib/cpp/Release-mt/
/lib/cpp/src/thrift/qt/moc_TQTcpServer.cpp
/lib/cpp/src/thrift/qt/moc__TQTcpServer.cpp
/lib/cpp/src/thrift/config.h
/lib/cpp/src/thrift/stamp-h2
/lib/cpp/test/Benchmark
/lib/cpp/test/AllProtocolsTest
/lib/cpp/test/DebugProtoTest
/lib/cpp/test/DenseProtoTest
/lib/cpp/test/EnumTest
/lib/cpp/test/JSONProtoTest
/lib/cpp/test/OptionalRequiredTest
/lib/cpp/test/SecurityTest
/lib/cpp/test/SpecializationTest
/lib/cpp/test/ReflectionTest
/lib/cpp/test/RecursiveTest
/lib/cpp/test/TFDTransportTest
/lib/cpp/test/TFileTransportTest
/lib/cpp/test/TInterruptTest
/lib/cpp/test/TNonblockingServerTest
/lib/cpp/test/TPipedTransportTest
/lib/cpp/test/TServerIntegrationTest
/lib/cpp/test/TSocketInterruptTest
/lib/cpp/test/TransportTest
/lib/cpp/test/UnitTests
/lib/cpp/test/ZlibTest
/lib/cpp/test/OpenSSLManualInitTest
/lib/cpp/test/concurrency_test
/lib/cpp/test/link_test
/lib/cpp/test/processor_test
/lib/cpp/test/tests.xml
/lib/cpp/concurrency_test
/lib/cpp/*.pc
/lib/cpp/x64/Debug/
/lib/cpp/x64/Debug-mt/
/lib/cpp/x64/Release
/lib/cpp/x64/Release-mt
/lib/c_glib/*.gcda
/lib/c_glib/*.gcno
/lib/c_glib/*.loT
/lib/c_glib/src/thrift/config.h
/lib/c_glib/src/thrift/stamp-h3
/lib/c_glib/test/*.gcno
/lib/c_glib/test/testwrapper.sh
/lib/c_glib/test/testwrapper-test*
/lib/c_glib/test/testapplicationexception
/lib/c_glib/test/testbinaryprotocol
/lib/c_glib/test/testcompactprotocol
/lib/c_glib/test/testbufferedtransport
/lib/c_glib/test/testcontainertest
/lib/c_glib/test/testdebugproto
/lib/c_glib/test/testfdtransport
/lib/c_glib/test/testframedtransport
/lib/c_glib/test/testmemorybuffer
/lib/c_glib/test/testoptionalrequired
/lib/c_glib/test/testsimpleserver
/lib/c_glib/test/teststruct
/lib/c_glib/test/testthrifttest
/lib/c_glib/test/testthrifttestclient
/lib/c_glib/test/testtransportsocket
/lib/c_glib/test/testserialization
/lib/c_glib/thriftc.pc
/lib/c_glib/thrift_c_glib.pc
/lib/csharp/**/bin/
/lib/csharp/**/obj/
/lib/csharp/src/packages
/lib/d/test/*.pem
/lib/d/libthriftd*.a
/lib/d/test/async_test
/lib/d/test/client_pool_test
/lib/d/test/serialization_benchmark
/lib/d/test/stress_test_server
/lib/d/test/thrift_test_client
/lib/d/test/thrift_test_server
/lib/d/test/transport_test
/lib/d/unittest/
/lib/dart/coverage
/lib/dart/**/.packages
/lib/dart/**/packages
/lib/dart/**/.pub/
/lib/dart/**/pubspec.lock
/lib/delphi/src/*.dcu
/lib/delphi/test/*.identcache
/lib/delphi/test/*.local
/lib/delphi/test/*.dcu
/lib/delphi/test/*.2007
/lib/delphi/test/*.dproj
/lib/delphi/test/*.dproj
/lib/delphi/test/codegen/*.bat
/lib/delphi/test/skip/*.local
/lib/delphi/test/skip/*.identcache
/lib/delphi/test/skip/*.identcache
/lib/delphi/test/skip/*.dproj
/lib/delphi/test/skip/*.dproj
/lib/delphi/test/skip/*.2007
/lib/delphi/test/serializer/*.identcache
/lib/delphi/test/serializer/*.dproj
/lib/delphi/test/serializer/*.local
/lib/delphi/test/serializer/*.2007
/lib/delphi/test/serializer/*.dcu
/lib/delphi/test/multiplexed/*.dproj
/lib/delphi/test/multiplexed/*.2007
/lib/delphi/test/multiplexed/*.local
/lib/delphi/test/multiplexed/*.identcache
/lib/delphi/test/multiplexed/*.dcu
/lib/delphi/test/typeregistry/*.2007
/lib/delphi/test/typeregistry/*.dproj
/lib/delphi/test/typeregistry/*.identcache
/lib/delphi/test/typeregistry/*.local
/lib/delphi/test/typeregistry/*.dcu
/lib/erl/.generated
/lib/erl/.eunit
/lib/erl/ebin
/lib/erl/deps/
/lib/erl/src/thrift.app.src
/lib/erl/test/*.hrl
/lib/erl/test/*.beam
/lib/haxe/test/bin
/lib/hs/dist
/lib/java/build
/lib/js/test/build
/lib/nodejs/coverage
/lib/nodejs/node_modules/
/lib/perl/MANIFEST
/lib/perl/MYMETA.json
/lib/perl/MYMETA.yml
/lib/perl/Makefile-perl.mk
/lib/perl/blib
/lib/perl/pm_to_blib
/lib/py/build
/lib/py/thrift.egg-info/
/lib/rb/Gemfile.lock
/lib/rb/debug_proto_test
/lib/rb/.config
/lib/rb/ext/conftest.dSYM/
/lib/rb/ext/mkmf.log
/lib/rb/ext/thrift_native.bundle
/lib/rb/ext/thrift_native.so
/lib/rb/test/
/lib/rb/thrift-*.gem
/lib/php/src/ext/thrift_protocol/Makefile.*
/lib/php/src/ext/thrift_protocol/build/
/lib/php/src/ext/thrift_protocol/config.*
/lib/php/src/ext/thrift_protocol/configure
/lib/php/src/ext/thrift_protocol/configure.in
/lib/php/src/ext/thrift_protocol/install-sh
/lib/php/src/ext/thrift_protocol/libtool
/lib/php/src/ext/thrift_protocol/ltmain.sh
/lib/php/src/ext/thrift_protocol/missing
/lib/php/src/ext/thrift_protocol/mkinstalldirs
/lib/php/src/ext/thrift_protocol/modules/
/lib/php/src/ext/thrift_protocol/php_thrift_protocol.lo
/lib/php/src/ext/thrift_protocol/run-tests.php
/lib/php/src/ext/thrift_protocol/thrift_protocol.la
/lib/php/src/ext/thrift_protocol/tmp-php.ini
/lib/php/src/packages/
/lib/php/test/TEST-*.xml
/lib/php/test/packages/
/lib/py/dist/
/lib/erl/logs/
/lib/go/test/gopath/
/lib/go/test/ThriftTest.thrift
/libtool
/ltmain.sh
/missing
/node_modules/
/stamp-h1
/test/features/results.json
/test/results.json
/test/c_glib/test_client
/test/c_glib/test_server
/test/cpp/StressTest
/test/cpp/StressTestNonBlocking
/test/cpp/TestClient
/test/cpp/TestServer
/test/dart/**/.packages
/test/dart/**/packages
/test/dart/**/.pub/
/test/dart/**/pubspec.lock
/test/log/
/test/test.log
/test/erl/.generated
/test/erl/ebin
/test/go/bin/
/test/go/ThriftTest.thrift
/test/go/gopath
/test/go/pkg/
/test/go/src/code.google.com/
/test/go/src/github.com/golang/
/test/go/src/gen/
/test/go/src/thrift
/test/haxe/bin
/test/hs/TestClient
/test/hs/TestServer
/test/py.twisted/_trial_temp/
/test/rb/Gemfile.lock
/tutorial/cpp/TutorialClient
/tutorial/cpp/TutorialServer
/tutorial/c_glib/tutorial_client
/tutorial/c_glib/tutorial_server
/tutorial/csharp/CsharpServer/obj
/tutorial/csharp/CsharpServer/bin
/tutorial/csharp/CsharpClient/obj
/tutorial/csharp/CsharpClient/bin
/tutorial/d/async_client
/tutorial/d/client
/tutorial/d/server
/tutorial/dart/**/.packages
/tutorial/dart/**/packages
/tutorial/dart/**/.pub/
/tutorial/dart/**/pubspec.lock
/tutorial/delphi/*.dsk
/tutorial/delphi/*.local
/tutorial/delphi/*.tvsconfig
/tutorial/delphi/DelphiClient/dcu
/tutorial/delphi/DelphiServer/dcu
/tutorial/delphi/DelphiClient/*.local
/tutorial/delphi/DelphiClient/*.identcache
/tutorial/delphi/DelphiServer/*.identcache
/tutorial/delphi/DelphiServer/*.local
/tutorial/go/go-tutorial
/tutorial/go/calculator-remote
/tutorial/go/src/shared
/tutorial/go/src/tutorial
/tutorial/go/src/git.apache.org
/tutorial/haxe/bin
/tutorial/hs/dist/
/tutorial/java/build/
/tutorial/js/build/
/ylwrap

View file

@ -1,199 +0,0 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
# build Apache Thrift on Travis CI - https://travis-ci.org/
sudo: required
dist: trusty
services:
- docker
install:
- (travis_wait ./build/docker/check_unmodified.sh $DISTRO && touch .unmodified) || true
- if [ ! -f .unmodified ]; then travis_retry travis_wait docker build -q -t thrift-build:$DISTRO build/docker/$DISTRO; fi
script:
- docker run --net=host -e BUILD_LIBS="$BUILD_LIBS" $BUILD_ENV -v $(pwd):/thrift/src -it thrift-build:$DISTRO build/docker/scripts/$SCRIPT $BUILD_ARG
env:
global:
- TEST_NAME=""
- SCRIPT="cmake.sh"
- BUILD_ARG=""
- BUILD_ENV="-e CC=clang -e CXX=clang++"
- DISTRO=ubuntu
- BUILD_LIBS="CPP C_GLIB HASKELL JAVA PYTHON TESTING TUTORIALS" # only meaningful for CMake builds
matrix:
- TEST_NAME="Cross Language Tests (Binary and Header Protocols)"
SCRIPT="cross-test.sh"
BUILD_ARG="-'(binary|header)'"
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
- TEST_NAME="Cross Language Tests (Debian) (Binary and Header Protocols)"
SCRIPT="cross-test.sh"
BUILD_ARG="-'(binary|header)'"
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
DISTRO=debian
- TEST_NAME="Cross Language Tests (Compact and JSON Protocols)"
SCRIPT="cross-test.sh"
BUILD_ARG="-'(compact|json)'"
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
- TEST_NAME="Cross Language Tests (Debian) (Compact and JSON Protocols)"
SCRIPT="cross-test.sh"
BUILD_ARG="-'(compact|json)'"
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
DISTRO=debian
# TODO: Remove them once migrated to CMake
# Autotools builds
- TEST_NAME="C C++ C# D Erlang Haxe Go (automake)"
SCRIPT="autotools.sh"
BUILD_ARG="--without-dart --without-haskell --without-java --without-lua --without-nodejs --without-perl --without-php --without-php_extension --without-python --without-ruby"
- TEST_NAME="C C++ - GCC (automake)"
SCRIPT="autotools.sh"
BUILD_ARG="--without-csharp --without-java --without-erlang --without-nodejs --without-lua --without-python --without-perl --without-php --without-php_extension --without-dart --without-ruby --without-haskell --without-go --without-haxe --without-d"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="Java Lua PHP Ruby Dart (automake)"
SCRIPT="autotools.sh"
BUILD_ARG="--without-cpp --without-haskell --without-c_glib --without-csharp --without-d --without-erlang --without-go --without-haxe --without-nodejs --without-python --without-perl"
# These are flaky (due to cabal and npm network/server failures) and also have lengthy output
- TEST_NAME="Haskell Node.js Python Perl (automake)"
SCRIPT="autotools.sh"
BUILD_ARG="--without-cpp --without-c_glib --without-csharp --without-d --without-dart --without-erlang --without-go --without-haxe --without-java --without-lua --without-php --without-php_extension --without-ruby"
# CMake build
- TEST_NAME="All"
- TEST_NAME="All (Debian)"
DISTRO=debian
- TEST_NAME="C C++ - GCC"
BUILD_LIBS="CPP C_GLIB TESTING TUTORIALS"
BUILD_ARG="-DWITH_PYTHON=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="C++ (Boost Thread)"
BUILD_LIBS="CPP TESTING TUTORIALS"
BUILD_ARG="-DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
- TEST_NAME="C++ (Boost Thread - GCC)"
BUILD_LIBS="CPP TESTING TUTORIALS"
BUILD_ARG="-DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="C++ (Std Thread)"
BUILD_LIBS="CPP TESTING TUTORIALS"
BUILD_ARG="-DWITH_STDTHREADS=ON -DCMAKE_CXX_FLAGS='-std=c++11' -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
- TEST_NAME="C++ (Std Thread - GCC)"
BUILD_LIBS="CPP TESTING TUTORIALS"
BUILD_ARG="-DWITH_STDTHREADS=ON -DCMAKE_CXX_FLAGS='-std=c++11' -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="Compiler (mingw)"
BUILD_LIBS=""
BUILD_ARG="-DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake -DBUILD_COMPILER=ON -DBUILD_LIBRARIES=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF"
BUILD_ENV=""
- TEST_NAME="All - GCC (CentOS)"
BUILD_ENV="-e CC=gcc -e CXX=g++"
DISTRO=centos
- TEST_NAME="C C++ - Clang (CentOS)"
BUILD_LIBS="CPP C_GLIB TESTING TUTORIALS"
BUILD_ARG="-DWITH_PYTHON=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
DISTRO=centos
- TEST_NAME="Python 2.6 (CentOS 6)"
BUILD_LIBS="PYTHON TESTING TUTORIALS"
BUILD_ARG="-DWITH_PYTHON=ON -DWITH_CPP=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
BUILD_ENV="-e CC=gcc -e CXX=g++"
DISTRO=centos6
# Distribution
- TEST_NAME="make dist"
SCRIPT="make-dist.sh"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="Debian Packages"
SCRIPT="dpkg.sh"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="make dist (Debian)"
SCRIPT="make-dist.sh"
BUILD_ENV="-e CC=gcc -e CXX=g++"
DISTRO=debian
- TEST_NAME="Debian Packages (Debian)"
SCRIPT="dpkg.sh"
BUILD_ENV="-e CC=gcc -e CXX=g++"
DISTRO=debian
matrix:
include:
# QA jobs for code analytics and metrics
#
# C/C++ static code analysis with cppcheck
# add --error-exitcode=1 to --enable=all as soon as everything is fixed
#
# Python code style check with flake8
#
# search for TODO etc within source tree
# some statistics about the code base
# some info about the build machine
- env: TEST_NAME="cppcheck, flake8, TODO FIXME HACK, LoC and system info"
install:
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install -ym cppcheck sloccount python-flake8
script:
# Compiler cppcheck (All)
- cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src
# C++ cppcheck (All)
- cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
# C Glib cppcheck (All)
- cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
# Silent error checks
- cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 compiler/cpp/src
- cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
- cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
# Python code style
- flake8 --ignore=E501 lib/py
- flake8 tutorial/py
- flake8 --ignore=E501 test/py
- flake8 test/py.twisted
- flake8 test/py.tornado
- flake8 --ignore=E501 test/test.py
- flake8 --ignore=E501 test/crossrunner
- flake8 test/features
# TODO etc
- grep -r TODO *
- grep -r FIXME *
- grep -r HACK *
# LoC
- sloccount .
# System Info
- dpkg -l
- uname -a

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more