Beispiel #1
0
def definition_closure(jobs, db):
    """ The result does not contain jobs (unless one job defines another) """
    #print('definition_closure(%s)' % jobs)
    check_isinstance(jobs, (list, set))
    jobs = set(jobs)
    from compmake.jobs.uptodate import CacheQueryDB
    cq = CacheQueryDB(db)
    stack = set(jobs)
    result = set()
    while stack:
        #print('stack: %s' % stack)
        a = stack.pop()
        if not cq.job_exists(a):
            print('Warning: job %r does not exist anymore; ignoring.' % a)
            continue

        if cq.get_job_cache(a).state == Cache.DONE:
            a_d = cq.jobs_defined(a)
            #print('%s ->%s' % (a, a_d))
            for x in a_d:
                result.add(x)
                stack.add(x)

    #print('  result = %s' % result)
    return result
Beispiel #2
0
def definition_closure(jobs, db):
    """ The result does not contain jobs (unless one job defines another) """
    #print('definition_closure(%s)' % jobs)
    check_isinstance(jobs, (list, set))
    jobs = set(jobs)
    from compmake.jobs.uptodate import CacheQueryDB
    cq = CacheQueryDB(db)
    stack = set(jobs)
    result = set()
    while stack:
        #print('stack: %s' % stack)
        a = stack.pop()
        if not cq.job_exists(a):
            print('Warning: job %r does not exist anymore; ignoring.' % a)
            continue

        if cq.get_job_cache(a).state == Cache.DONE:
            a_d = cq.jobs_defined(a)
            #print('%s ->%s' % (a, a_d))
            for x in a_d:
                result.add(x)
                stack.add(x)

    #print('  result = %s' % result)
    return result