Add support for affinity & bug fix for job array