Inspect running jobs
A successful job submission is not an indication of a successfully-running job. This is the nature of a highly-optimistic scheduler. A successful job submission means the server was able to issue the proper scheduling commands. It does not indicate the job is actually running. To verify the job is running and healthy, you might need to inspect its state.
This section will utilize the job named "docs" from the previous sections, but these operations and command largely apply to all jobs in Nomad.
Query the job status
After a job is submitted, you can query the status of that job using the job status command:
At a high level, you can observe that the job is currently running, but what does "running" actually mean. By supplying the name of a job to the job status command, you can ask Nomad for more detailed job information:
This output shows that there are three instances of this task running, each with
its own allocation. For more information on the status
command, please consult
the nomad job status
command documentation.
Fetch an evaluation's status
You can think of an evaluation as a submission to the scheduler. An example below shows status output for a job where some allocations were placed successfully, but did not have enough resources to place all of the desired allocations.
If you issue the status command with the -evals
flag, the output will show
that there is an outstanding evaluation for this hypothetical job:
The output states that the job has a "blocked" evaluation that is in progress. When Nomad can not place all the desired allocations, it creates a blocked evaluation that waits for more resources to become available.
The eval status
command enables examination of any evaluation in more detail.
For the most part this should never be necessary. However, it can be useful to
understand what triggered a specific evaluation and it's current status. Running
it on the "complete" evaluation provides output similar to the following:
This output indicates that the evaluation was created by a "job-register" event and that it had placement failures. The evaluation also has the information on why placements failed. Also output is the evaluation of any follow-up evaluations created.
If you would like to learn more about this output, consult the documentation for
nomad eval status
command.
Retrieve an allocation's status
You can think of an allocation as an instruction to schedule. Like an
application or service, an allocation has logs and state. The alloc status
command gives the most recent events that occurred for a task, its resource
usage, port allocations and more:
The nomad alloc status
command is a good starting to point for debugging an
application that did not start. Hypothetically assume a user meant to start a
Docker container named "redis:2.8", but accidentally put a comma instead of a
period, typing "redis:2,8".
When the job is executed, it produces a failed allocation. The nomad alloc status
command will give the reason why.
Unfortunately not all failures are as visible in the allocation status output.
If the alloc status
command shows many restarts, there is likely an
application-level issue during start up. For example:
To debug these failures, you can use the nomad alloc logs
command, which is
discussed in the accessing logs section of this documentation.
For more information on the alloc status
command, please consult the
documentation for the nomad alloc status
command.