# define weight to be 1, since this slot supports exactly one match SLOT_WEIGHT = 1 {endcode} + +{subsubsection: Multi-Centric Policy} +What is "most limiting" resource might be contingent on job requirements. It is possible to define slot weight to take this into account, as in this example: +{code} +# Either Cpus or Memory might be limiting, depending on job requirements +CONSUMPTION_CPUS = target.RequestCpus +CONSUMPTION_MEMORY = quantize(target.RequestMemory, {256}) +CONSUMPTION_DISK = quantize(target.RequestDisk, {128}) +# define slot weight as minimum of remaining-match estimate based on either cpus or memory: +SLOT_WEIGHT = ifThenElse(Cpus < floor(Memory/256), Cpus, floor(Memory/256)) +{endcode} + +{subsubsection: Handle missing request attributes} +RequestXxx attributes are not always guaranteed to be present, so Consumption Policy expressions should take this into account. For example a policy that involves Extensible Resources cannot assume jobs will be requesting such a resource. +{code} +# declare an extensible resource +MACHINE_RESOURCE_actuators = 8 +# policy for actuators that interprets missing request as 'zero', which is a good idiom for extensibe resources that many jobs are likely to not use or care about +CONSUMPTION_ACTUATORS = ifThenElse(target.RequestActuators =!= undefined, target.RequestActuators, 0) +{endcode}