def block_until_complete(jenkinsurl, jobs, maxwait=12000, interval=30, raise_on_timeout=True):
    assert maxwait > 0
    assert maxwait > interval
    assert interval > 0

    obj_jenkins = Jenkins(jenkinsurl)
    obj_jobs = [obj_jenkins[jid] for jid in jobs]
    for time_left in xrange(maxwait, 0, -interval):
        still_running = [j for j in obj_jobs if j.is_queued_or_running()]
        if not still_running:
            return
        str_still_running = ", ".join('"%s"' % str(a) for a in still_running)
        log.warn( "Waiting for jobs %s to complete. Will wait another %is" % (str_still_running, time_left ))
        time.sleep(interval)
    if raise_on_timeout:
        #noinspection PyUnboundLocalVariable
        raise TimeOut("Waited too long for these jobs to complete: %s" % str_still_running)
Wait until all of the jobs in the list are complete.
dataset/ETHPy150Open ramonvanalteren/jenkinsapi/jenkinsapi/api.py/block_until_complete