nomad icon indicating copy to clipboard operation
nomad copied to clipboard

[feature request] be able override resources in parameterized job

Open shantanugadgil opened this issue 5 years ago • 4 comments

Nomad version

Nomad v0.11.3 (8918fc804a0c6758b6e3e9960e4eb2e605e38552)

Operating system and Environment details

CentOS 7/8, Ubuntu 18.04

Issue

I want to be able to register a parameterized job and then, be able to have different resource constraints for each dispatch of the job instance.

Also, if I were to move the meta from required to optional, how would I be able to specify a default value for the optional parameter?

Reproduction steps

Job file (if appropriate)

File: param1.nomad

job "param1" {
  type = "batch"

  parameterized {
    payload       = "forbidden"
    meta_required = ["CPU_VALUE"]
  }

  group "mygroup" {
    task "mytask" {
      driver = "raw_exec"

      config {
        command = "/bin/sleep"
        args    = ["300"]
      }

      resources {
        cpu    = "${NOMAD_META_CPU_VALUE}"  # this does not work (of course), but that's what I want to achieve
        memory = 256

        network {
          mbits = 100
        }
      }
    }
  }
}

Use Case

The parameterized job is used to build different software components, some require more CPU/MEMORY than others while building, hence reserving the same cpu/memory for each dispatch is "sub-optimal". n/a

shantanugadgil avatar Jun 24 '20 02:06 shantanugadgil

I'm going to mark this with hcl because it's the sort of thing we might be able to improve upon when we embark on our HCL2 migration.

tgross avatar Jun 24 '20 12:06 tgross

"embark" makes it sound quite far away! 😀

for now, I see just doing a full render (using levant/or equivalent) which will set job and task specific values all over.

just updating, in case anyone else reaches here while searching

shantanugadgil avatar Jun 24 '20 13:06 shantanugadgil

https://github.com/hashicorp/nomad/issues/12228 was a duplicate of this and I've closed that. But that also made me realize I should have removed the hcl label from this one, as it really doesn't help for this use case because HCL2 parsing is done in the CLI and not in the server.

tgross avatar Mar 08 '22 16:03 tgross

☝️ +1 this would come really handy

RCM7 avatar Dec 21 '22 16:12 RCM7

+1 this would really help me too

shemi-plgs avatar Feb 02 '23 15:02 shemi-plgs