Commit Graph

147 Commits

Author SHA1 Message Date
Mahmood Ali
58cbafe913 Populate alloc stats API with device stats
This change makes few compromises:

* Looks up the devices associated with tasks at look up time.  Given
that `nomad alloc status` is called rarely generally (compared to stats
telemetry and general job reporting), it seems fine.  However, the
lookup overhead grows bounded by number of `tasks x total-host-devices`,
which can be significant.

* `client.Client` performs the task devices->statistics lookup.  It
passes self to alloc/task runners so they can look up the device statistics
allocated to them.
  * Currently alloc/task runners are responsible for constructing the
entire RPC response for stats
  * The alternatives for making task runners device statistics aware
don't seem appealing (e.g. having task runners contain reference to hostStats)

* On the alloc aggregation resource usage, I did a naive merging of task device statistics.
  * Personally, I question the value of such aggregation, compared to
costs of struct duplication and bloating the response - but opted to be
consistent in the API.
  * With naive concatination, device instances from a single device group used by separate tasks in the alloc, would be aggregated in two separate device group statistics.
2018-11-16 10:26:32 -05:00
Preetha Appan
ed4ed16b5d Parsing and API layer for spread stanza 2018-09-04 16:10:11 -05:00
Preetha Appan
1774aa2526 Remove unused field 2018-09-04 16:10:11 -05:00
Preetha Appan
8f2d5742c4 Affinity parsing, api and structs 2018-09-04 16:10:11 -05:00
Alex Dadgar
20df5aea5b Canary tags structs 2018-05-07 14:50:01 -05:00
Michael Schurter
905bef8f2d consul: make grpc checks more like http checks 2018-05-04 11:08:11 -07:00
Michael Schurter
93356e7d70 consul: initial grpc implementation
Needs to be more like http.
2018-05-04 11:08:11 -07:00
Preetha Appan
20a029adaa add canonicalize for reschedulepolicy to simplify validation logic 2018-04-11 18:47:27 -05:00
Preetha Appan
beb1a013db Always merge with default reschedule policy if its not nil 2018-04-11 15:26:01 -05:00
Preetha Appan
532c106b63 Make system jobs fail validation if they contain a reschedule stanza 2018-04-11 14:56:20 -05:00
Preetha Appan
e2226ca2b7 s/linear/constant/g 2018-03-26 14:45:09 -05:00
Alex Dadgar
7f989499ff Correct defaulting 2018-03-21 16:51:44 -07:00
Michael Schurter
95b3b6eb02 drain: initial drainv2 structs and impl 2018-03-21 16:49:48 -07:00
Preetha Appan
a896b2edf2 Addressed code review feedback 2018-03-21 09:15:29 -05:00
Preetha Appan
5e038e4106 Show reschedule policy in addition to when the eval will get rescheduled 2018-03-20 13:34:29 -05:00
Preetha Appan
f82c100dfc Fix linting 2018-03-19 12:46:55 -05:00
Preetha Appan
e5b86d405e Fix incorrect initialization of reschedule policy for system jobs. 2018-03-19 12:16:13 -05:00
Preetha Appan
d4056c4489 Rename DelayCeiling to MaxDelay 2018-03-14 16:10:32 -05:00
Preetha Appan
e65d870fe9 Add new reschedule options to API layer and unit tests 2018-03-14 16:10:32 -05:00
Josh Soref
4c96d1bb90 spelling: canonicalize 2018-03-11 17:46:20 +00:00
Preetha Appan
15186170b4 Reuse default policy structs in api, and other code review feedback 2018-01-31 16:33:00 -06:00
Preetha Appan
89a467aaaf Remove unused method 2018-01-31 09:58:05 -06:00
Preetha Appan
162f75e834 Address code review comments 2018-01-31 09:58:05 -06:00
Preetha Appan
eab9d2da92 Add reschedule policy to API, and HCL parsing support. 2018-01-31 09:56:53 -06:00
Michael Schurter
9b9a4af182 Invert and test CheckRestart merge logic 2018-01-09 15:17:07 -08:00
Michael Schurter
304a037e39 Fix service.check_restart stanza propagation
There was a bug in jobspec parsing, a bug in CheckRestart merging, and a
bug in CheckRestart canonicalization. All are now tested.
2018-01-09 15:15:36 -08:00
Michael Schurter
25569282b9 Allow custom ports for services and checks
Fixes #3380

Adds address_mode to checks (but no auto) and allows services and checks
to set literal port numbers when using address_mode=driver.

This allows SDNs, overlays, etc to advertise internal and host addresses
as well as do checks against either.
2017-12-08 12:03:00 -08:00
Chelsea Holland Komlo
20d1a3b54d fix up test fixture to properly parse 2017-12-06 16:23:55 -05:00
Chelsea Holland Komlo
9e49836d4f move kill_signal to task level, extend to docker 2017-12-06 14:36:39 -05:00
Preetha Appan
4e307587f0 Fixes bug with display message logic due to deprecating GenericSource. Also added more test cases to cover a bunch more edge cases 2017-11-13 11:14:57 -06:00
Charlie Voiselle
892f34896b Simplified based on review comments 2017-11-09 20:09:37 -05:00
Charlie Voiselle
20ea6b25dc Adopted pattern from LogConfig to handle panic when no resource stanza at all
In testing realized that Resources night not be present at all.  Testing this case caused panic. Added in a means to collect clean defaults in that case.
2017-11-09 10:57:57 -05:00
Charlie Voiselle
1cb52865bc Canonicalize task and remove merge with MinResources
The current code would merge the job with the output of MinResources causing the nil to be replaced with MemoryMB=helper.IntToPtr(10).  When later `Canonicalize`d, the 10 would cause the default of 300 not to be applied. Running `Canonicalize` on the task itself guarantees that CPU, MemoryMB, and IOPS is set, so we can remove the Merge withMinResources.
2017-11-09 10:10:11 -05:00
Preetha Appan
48f90089d5 Fix formatting 2017-11-03 12:48:55 -05:00
Preetha Appan
aa253b07ab Adds deprecation notice to API struct definition. 2017-11-03 10:12:37 -05:00
Preetha Appan
d63e693679 Move logic for determinic event display message to task_runner, added two new fields DisplayMessage and Details. 2017-11-03 09:13:01 -05:00
Alex Dadgar
61bcfff20a Change vault_grace default to match vaults 2017-10-11 17:20:12 -07:00
Michael Schurter
b381b5fff7 grace_period -> grace 2017-09-26 10:21:35 -07:00
Michael Schurter
80147622c5 Add comments 2017-09-15 14:34:36 -07:00
Michael Schurter
092057a32b Canonicalize and Merge CheckRestart in api 2017-09-14 16:48:39 -07:00
Michael Schurter
78c72f8725 Default grace period to 1s 2017-09-14 16:46:54 -07:00
Michael Schurter
555d1e24dc on_warning=false -> ignore_warnings=false
Treat warnings as unhealthy by default
2017-09-14 16:46:54 -07:00
Michael Schurter
bd1a342a92 Nest restart fields in CheckRestart 2017-09-14 16:46:54 -07:00
Michael Schurter
a720bb5a91 Add restart fields 2017-09-14 16:46:54 -07:00
Alex Dadgar
6723bade37 Don't merge empty update from job into task groups
This PR fixes an issue in which we would merge an update stanza from the
job into the task groups even if it was empty. This broke round
tripping a job (reading from the api and resubmitting as JSON)

Fixes https://github.com/hashicorp/nomad/issues/3132
2017-08-30 11:35:19 -07:00
Michael Schurter
947516405a Add Header and Method support for HTTP checks 2017-08-17 16:44:21 -07:00
Michael Schurter
beae45bad5 Add optional shutdown delay to tasks
Fixes #2441

Defaults to 0 (no delay) for backward compat and because this feature
should be opt-in.
2017-08-16 17:59:46 -07:00
Alex Dadgar
43d2c425d1 Emit generic task events 2017-08-07 21:26:04 -07:00
Alex Dadgar
053cff812a Allow template to set Vault grace
This PR allows a template to specify the Vault grace duration.

Fixes https://github.com/hashicorp/nomad/issues/2922
2017-08-01 14:14:08 -07:00
Alex Dadgar
27048bb7fa events 2017-07-07 12:12:48 -07:00