Created
November 21, 2018 00:41
-
-
Save notnoop/151105c99070d93333bed23aec7ce42c to your computer and use it in GitHub Desktop.
illustrating job run behavior after completion with Nomad 0.8.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@cc8ad15fa0f9:/tmp/jobs# cat ./test.nomad | |
job "test" | |
{ | |
datacenters = ["dc1"] | |
type = "batch" | |
task "diamondbcapacitycollector" | |
{ | |
driver = "exec" | |
config | |
{ | |
command = "sleep" | |
args = ["1"] | |
} | |
resources | |
{ | |
cpu = 100 | |
memory = 300 | |
} | |
} | |
} | |
root@cc8ad15fa0f9:/tmp/jobs# # first run | |
root@cc8ad15fa0f9:/tmp/jobs# nomad job run ./test.nomad | |
==> Monitoring evaluation "6dc35565" | |
Evaluation triggered by job "test" | |
Allocation "42f848fb" created: node "cbd93e44", group "diamondbcapacitycollector" | |
Allocation "42f848fb" status changed: "pending" -> "running" | |
Evaluation status changed: "pending" -> "complete" | |
==> Evaluation "6dc35565" finished with status "complete" | |
root@cc8ad15fa0f9:/tmp/jobs# # wait and see if running causes any new allocations | |
root@cc8ad15fa0f9:/tmp/jobs# sleep 2; nomad job plan ./test.nomad | |
Job: "test" | |
Task Group: "diamondbcapacitycollector" (2 ignore) | |
Task: "diamondbcapacitycollector" | |
Scheduler dry-run: | |
- All tasks successfully allocated. | |
Job Modify Index: 34 | |
To submit the job with version verification run: | |
nomad job run -check-index 34 ./test.nomad | |
When running the job with the check-index flag, the job will only be run if the | |
server side version matches the job modify index returned. If the index has | |
changed, another user has modified the job and the plan's results are | |
potentially invalid. | |
root@cc8ad15fa0f9:/tmp/jobs# nomad job run ./test.nomad | |
==> Monitoring evaluation "86324a23" | |
Evaluation triggered by job "test" | |
Evaluation status changed: "pending" -> "complete" | |
==> Evaluation "86324a23" finished with status "complete" | |
root@cc8ad15fa0f9:/tmp/jobs# nomad job status test | |
ID = test | |
Name = test | |
Submit Date = 2018-11-21T00:36:47Z | |
Type = batch | |
Priority = 50 | |
Datacenters = dc1 | |
Status = dead | |
Periodic = false | |
Parameterized = false | |
Summary | |
Task Group Queued Starting Running Failed Complete Lost | |
diamondbcapacitycollector 0 0 0 0 1 0 | |
Allocations | |
ID Node ID Task Group Version Desired Status Created Modified | |
42f848fb cbd93e44 diamondbcapacitycollector 0 run complete 28s ago 26s ago | |
root@cc8ad15fa0f9:/tmp/jobs# # so plan revealed no action, and running it was basically a noop | |
root@cc8ad15fa0f9:/tmp/jobs# # let's try again with simple modification | |
root@cc8ad15fa0f9:/tmp/jobs# sed -i -e 's|"1"|"2"|g' ./test.nomad | |
root@cc8ad15fa0f9:/tmp/jobs# nomad job plan ./test.nomad | |
+/- Job: "test" | |
+/- Task Group: "diamondbcapacitycollector" (1 create, 2 ignore) | |
+/- Task: "diamondbcapacitycollector" (forces create/destroy update) | |
+/- Config { | |
+/- args[0]: "1" => "2" | |
command: "sleep" | |
} | |
Scheduler dry-run: | |
- All tasks successfully allocated. | |
Job Modify Index: 34 | |
To submit the job with version verification run: | |
nomad job run -check-index 34 ./test.nomad | |
When running the job with the check-index flag, the job will only be run if the | |
server side version matches the job modify index returned. If the index has | |
changed, another user has modified the job and the plan's results are | |
potentially invalid. | |
root@cc8ad15fa0f9:/tmp/jobs# nomad job run ./test.nomad | |
==> Monitoring evaluation "c5d7ca4d" | |
Evaluation triggered by job "test" | |
Allocation "b49745ba" created: node "cbd93e44", group "diamondbcapacitycollector" | |
Allocation "b49745ba" status changed: "pending" -> "running" | |
Evaluation status changed: "pending" -> "complete" | |
==> Evaluation "c5d7ca4d" finished with status "complete" | |
root@cc8ad15fa0f9:/tmp/jobs# nomad job status test | |
ID = test | |
Name = test | |
Submit Date = 2018-11-21T00:37:56Z | |
Type = batch | |
Priority = 50 | |
Datacenters = dc1 | |
Status = dead | |
Periodic = false | |
Parameterized = false | |
Summary | |
Task Group Queued Starting Running Failed Complete Lost | |
diamondbcapacitycollector 0 0 0 0 2 0 | |
Allocations | |
ID Node ID Task Group Version Desired Status Created Modified | |
b49745ba cbd93e44 diamondbcapacitycollector 1 run complete 7s ago 5s ago | |
42f848fb cbd93e44 diamondbcapacitycollector 0 run complete 1m16s ago 1m14s ago |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment