You can get the socket_id from job by doing: job.data.socket_id
With that you can index into the hash and avoid doing lines 35 through 39.