Optional hardware attributes for Slurm agents
https://redmine.teklia.com/issues/5075
We should assume that Ponos agents running tasks on Slurm instead of Docker have infinite hardware requirements, as the real task assignation is managed by Slurm itself. For this reason, we need a way to determine whether an agent is using Slurm or Docker, and we need to make the agent hardware requirements optional.
A new Agent.mode
field should be added to Ponos agents, as an EnumField
using a new AgentMode
enum, with two values: docker
and slurm
. The field defaults to docker
.
The cpu_cores
, cpu_frequency
, and ram_total
fields should be made nullable.
A new check constraint should verify that cpu_cores
, cpu_frequency
and ram_total
are not null, but only when the mode is not slurm
. That is doable with an OR
: mode = 'slurm' OR (cpu_cores IS NOT NULL AND ...)
.