2021-06-11T09:41:11.486-0500 [INFO] agent: Nomad Autoscaler agent started! Log data will stream in below:
2021-06-11T09:41:11.486-0500 [INFO] agent.http_server: server now listening for connections: address=127.0.0.1:8080
2021-06-11T09:41:11.668-0500 [INFO] agent.plugin_manager: successfully launched and dispensed plugin: plugin_name=nomad-target
2021-06-11T09:41:12.191-0500 [INFO] external_plugin.noop-target: set config: config=map[nomad_address:http://localhost:4646] timestamp=2021-06-11T09:41:12.191-0500
2021-06-11T09:41:12.191-0500 [INFO] agent.plugin_manager: successfully launched and dispensed plugin: plugin_name=noop-target
2021-06-11T09:41:12.281-0500 [INFO] agent.plugin_manager: successfully launched and dispensed plugin: plugin_name=nomad-apm
2021-06-11T09:41:12.281-0500 [INFO] agent.plugin_manager: successfully launched and dispensed plugin: plugin_name=target-value
2021-06-11T09:41:12.281-0500 [INFO] agent.plugin_manager: successfully launched and dispensed plugin: plugin_name=fixed-value
2021-06-11T09:41:12.282-0500 [INFO] policy_eval: starting workers: cluster=10 horizontal=10
2021-06-11T09:41:26.800-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:26.800-0500
2021-06-11T09:41:26.801-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:26.801-0500
2021-06-11T09:41:31.800-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:31.800-0500
2021-06-11T09:41:31.800-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:31.800-0500
2021-06-11T09:41:36.802-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:36.802-0500
Now I run nomad job stop testjob and expect that autoscaler will perform scaling down from 3 to 0, but it keeps querying the status:
2021-06-11T09:41:41.802-0500 [INFO] external_plugin.noop-target: received status request: ready=true count=3 timestamp=2021-06-11T09:41:41.802-0500
2021-06-11T09:41:41.802-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:41.802-0500
2021-06-11T09:41:46.801-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:46.801-0500
2021-06-11T09:41:46.801-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:46.801-0500
2021-06-11T09:41:51.802-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:51.802-0500
2021-06-11T09:41:51.802-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:51.802-0500
2021-06-11T09:41:56.802-0500 [INFO] external_plugin.noop-target: received status request: count=3 ready=true timestamp=2021-06-11T09:41:56.802-0500
If I do nomad job stop -purge testjob autoscaler stops doing anything. Kinda not what I would expect.
You need a scaling policy that targets your cluster clients. Take a look at the policy shown as an example in the “Run the Nomad Autoscaler job” section of the tutorial: