replace whole block with
```
from vsc.utils.affinity import sched_getaffinity

max_num_cores = sum(sched_getaffinity().cpus)
```
it takes into account taskset too.