You are putting the cart before the horse here. While you can get access to all the node using --exclusive, when you request cores, you will not know if you have more. For example you request 80 cores and land on a 40 and a 48 with exclusive access. You would need to do some sort of discovery to know what is available versus what you asked for. When using exclusive, it becomes more like "I want at least X cores" and you get "Ok, here are X cores or more"
Within your script, you could check for total cores. something
like 'srun lscpu' and parse the output.
Brian Andrus