It took me quite some time to ultimately figure out how to set the custom_attributes kwarg in JobAttributes. I think it warrants a brief section in the docs and a clearer docstring.
Basically, as it currently stands, I had assumed I could do custom_attributes={"constraints": "cpu"} but was puzzled when it didn't appear in the Slurm job script. Only through diving through the test suite was I able to figure out that I needed to do custom_attributes={"slurm.constraints": "cpu"} instead.
I am happy to add this, but it may take me a few days to get around to it.