Does the automatic anti-affinity work with parameterized jobs

Hi Guys,

I have two datacenters, dc1 and dc2. I’d like to a goal like this:

  1. The job should be executed on dc2 only after dc1 is full.
  2. On dc1, the job should be dispatched evenly for all the machines but on dc2, the jobs should be dispatched using bin-packing.

I created a parameterized job and used this setting of affinity:

affinity {
attribute = “${node.datacenter}”
value = “dc1”
weight = 100
}

The 1st goal seems to be achieved but the the 2nd one doesn’t. I searched in google and found someone said “nomad has an automatic anti-affinity to prevent a node from running too many jobs.”. But when I was using nomad alloc status to check the ranking, the anti-affinity score was always 0, not negative.

Does the automatic anti-affinity work with parameterized jobs? If not how could I achieve the above goals?

Thanks very much

Best,

Luxiang