Skip to content

[question] Clarification on mode=fail in job spec #2286

@BSick7

Description

@BSick7

A job contains a single task group with the following:

                "RestartPolicy": {
                    "Interval": 0,
                    "Attempts": 1,
                    "Delay": 0,
                    "Mode": "fail"
                },

If this job fails with exit code 1, it will continue to repeat the task.
Am I misunderstanding the nomad docs or is this expected?
How can I get the desired behavior of allowing only 1 execution (success or failure)?

(tail snippet of job status)

Allocations
ID        Eval ID   Node ID   Task Group  Desired  Status   Created At
3cdd82a5  6a13d452  c809c1ad  deploy      run      running  02/06/17 10:43:41 UTC

(tail snippet of alloc status of 3cdd82a5)

Recent Events:
Time                   Type        Description
02/06/17 13:21:30 UTC  Started     Task started by client
02/06/17 13:21:29 UTC  Restarting  Task restarting in 1ns
02/06/17 13:21:29 UTC  Terminated  Exit Code: 1, Exit Message: "Docker container exited with non-zero exit code: 1"
02/06/17 13:21:22 UTC  Started     Task started by client
02/06/17 13:21:21 UTC  Restarting  Task restarting in 1ns
02/06/17 13:21:21 UTC  Terminated  Exit Code: 1, Exit Message: "Docker container exited with non-zero exit code: 1"
02/06/17 13:21:13 UTC  Started     Task started by client
02/06/17 13:21:12 UTC  Restarting  Task restarting in 1ns
02/06/17 13:21:12 UTC  Terminated  Exit Code: 1, Exit Message: "Docker container exited with non-zero exit code: 1"
02/06/17 13:21:06 UTC  Started     Task started by client

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions