예제 #1
0
    def setUp(self):
        use_filesystem('test1_db')
        set_namespace('Test1')
        remove_all_jobs()

        reset_jobs_definition_set()
        
        self.jobs = [
                ('a', Cache.DONE),
                ('b', Cache.FAILED),
                ('c', Cache.NOT_STARTED),
                ('d', Cache.DONE),
                ('e', Cache.DONE),
                ('f', Cache.IN_PROGRESS),
                ('g', Cache.DONE),
                ('h', Cache.FAILED),
                ('i', Cache.DONE),
                ('ii', Cache.DONE),
                ('v_rangefinder_nonunif-plot_tensors_tex-0', Cache.DONE),
        ]
        
        for job_id, state in self.jobs:
            comp(dummy, job_id=job_id)
            cache = get_job_cache(job_id)
            cache.state = state
            set_job_cache(job_id, cache)

        self.all = set([job_id for job_id, state in self.jobs])
        select = lambda S: set([id for id, state in self.jobs if state == S])
        self.failed = select(Cache.FAILED)
        self.done = select(Cache.DONE)
        self.in_progress = select(Cache.IN_PROGRESS)
        self.not_started = select(Cache.NOT_STARTED)
예제 #2
0
def comp_store(x, job_id=None):
    """ 
    
    Stores the object as a job, keeping track of whether
        we have it.  
    """
    
    id_object = id(x)
    
    if not id_object in Stored.objectid2job:
        job_params = {}
        if job_id is not None:
            job_params['job_id'] = job_id
        
        job = comp(load_static_storage, x, **job_params)
        Stored.objectid2job[id_object] = job
        
    return Stored.objectid2job[id_object]