Nomad: [Question] How to disable retry/reschedule in batch job?

Created on 12 Oct 2019  路  2Comments  路  Source: hashicorp/nomad

Nomad version

0.9.6

Operating system and Environment details

CentOS

I'm try to put this but not work:

     "reschedule": {
                "attempts": 0,
                "unlimited": false
              },
typquestion

Most helpful comment

I've been able to keep my batch jobs from both retrying and rescheduling by doing the following.
Adding a restart stanza and a reschedule stanza.

job "echo-dispatch" {
  datacenters = ["dc1"]
  type = "batch"
  priority = 1

  parameterized {
    payload = "forbidden"
    meta_required = ["message"]
    meta_optional = []
  }

  group "echo" {
    task "echo" {
      driver = "exec"
      config {
        command = "echo"
        args = ["${NOMAD_META_message}"]
      }
    }
    restart {
      attempts = 0
      mode = "fail"
    }
  }
  reschedule {
    attempts = 0
  }
}

All 2 comments

I've been able to keep my batch jobs from both retrying and rescheduling by doing the following.
Adding a restart stanza and a reschedule stanza.

job "echo-dispatch" {
  datacenters = ["dc1"]
  type = "batch"
  priority = 1

  parameterized {
    payload = "forbidden"
    meta_required = ["message"]
    meta_optional = []
  }

  group "echo" {
    task "echo" {
      driver = "exec"
      config {
        command = "echo"
        args = ["${NOMAD_META_message}"]
      }
    }
    restart {
      attempts = 0
      mode = "fail"
    }
  }
  reschedule {
    attempts = 0
  }
}

@jonatasfreitasv the reschedule/restart stanzas provided by @erhlee-bird above are the right way to disable rescheduling and local restarts. Closing this since the question has been answered

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bdclark picture bdclark  路  3Comments

stongo picture stongo  路  3Comments

clinta picture clinta  路  3Comments

jippi picture jippi  路  3Comments

dvusboy picture dvusboy  路  3Comments