'Produce a reproducible hash for the given job on various
criteria - for instance if hash_by is "workflow_invocation,history" -
all jobs within the same workflow invocation will receive the same
hash - for jobs outside of workflows all jobs within the same history
will receive the same hash, other jobs will be hashed on job\'s id
randomly.
Primarily intended for use with ``choose_one`` above - to consistent
route or schedule related jobs.'

def job_hash(self, job, hash_by=None):

    if (hash_by is None):
        hash_by = ['job']
    hash_bys = util.listify(hash_by)
    for hash_by in hash_bys:
        job_hash = self._try_hash_for_job(job, hash_by)
        if job_hash:
            return job_hash
    return self._try_hash_for_job(job, 'job')
