'Return the job for the given dataset. This will throw an error if the
dataset is either nonexistent or inaccessible to the user.'

def _get_job_for_dataset(self, trans, dataset_id):

    hda = trans.sa_session.query(trans.app.model.HistoryDatasetAssociation).get(self.decode_id(dataset_id))
    assert (hda and self._can_access_dataset(trans, hda))
    return hda.creating_job
