def get_test_jobs(args):
    dbsession = models.get_session()
    TJ = models.TestJob
    for jobid in args:
        try:
            jobid = int(jobid)
        except __HOLE__:
            pass
        try:
            if type(jobid) is int:
                testjob = dbsession.query(TJ).get(jobid)
            else:
                testjob = dbsession.query(TJ).filter(TJ.name==jobid).one()
        except models.NoResultFound:
            logging.warn("No TestJob with id %r" % jobid)
            continue
        else:
            yield testjob
dataset/ETHPy150Open kdart/pycopia/QA/pycopia/QA/jobrunner.py/get_test_jobs