How to stop job when all allocations are dead?

I have a job that is supposed to be short lived - its only allocation basically runs sleep 3600 and then dies. I would like the job itself to stop after this allocation dies, but it’s stuck in pending. Any tips?

Thanks!

Hi @robinovitch61,

This sounds like the job specification type parameter needs to be updated to batch from service. The Nomad website has a page detailing the schedulers which might be useful reading.

Thanks,
jrasell and the Nomad team

Hi @jrasell, thanks for the fast reply! Ah I misread your response - that sounds right! Thank you!

I should have included the job spec in the question:

job "redacted" {
  datacenters = ["redacted"]
  type = "service"

  update {
    stagger      = "5s"
    auto_revert  = true
  }

  group "redacted" {
    count = 1

    restart {
      attempts = 0
    }

    task "redacted" {
      driver = "docker"

      vault {
        policies = ["nomad-read"]
      }

      config {
        image = "my-image"
        command = "sleep"
        args =["3600"]
      }

      resources {
        cpu    = 563
        memory = 2048
      }

      service {
        name = "redacted"

        tags = ["redacted"]
        
        check {
          type     = "script"
          name     = "test"
          command  = "echo"
          args     = ["hi"]
          interval = "60s"
          timeout  = "5s"
        }
      }
    }
  }
}