예제 #1
0
 def run_second(self, root):
     info('run_second()')
     db = StorageFilesystem(root, compress=True)
     cc = Context(db=db)
     # 
     cc.comp_dynamic(f2, job_id='f')
     cc.batch_command('clean;make recurse=1')
예제 #2
0
 def run_first(self, root):
     db = StorageFilesystem(root, compress=True)
     cc = Context(db=db)
     # 
     cc.comp(g, job_id='g')
     cc.comp(h, job_id='h')
     cc.batch_command('make')
예제 #3
0
 def run_second(self, root):
     print('run_second()')
     db = StorageFilesystem(root, compress=True)
     cc = Context(db=db)
     # 
     cc.comp_dynamic(e2, job_id='e')
     cc.batch_command('details e;clean;ls;make recurse=1')
예제 #4
0
 def run_first(self, root):
     print('run_first()')
     db = StorageFilesystem(root, compress=True)
     cc = Context(db=db)
     # 
     cc.comp_dynamic(e1, job_id='e')
     cc.batch_command('make recurse=1; ls')
예제 #5
0
def main():
    print('This is an example of how to use the "progress" function.')
    from compmake import Context

    c = Context()

    c.comp(mylongfunction)

    # Run command passed on command line or otherwise run console.    
    cmds = sys.argv[1:]
    if cmds:
        c.batch_command(' '.join(cmds))
    else:
        print('Use "make recurse=1" or "parmake recurse=1" to make all.')
        c.compmake_console()
예제 #6
0
def main():
    from compmake import Context

    c = Context()

    for param1 in [1, 2, 3]:
        for param2 in [10, 11, 12]:
            res1 = c.comp(func1, param1)
            res2 = c.comp(func2, res1, param2)
            c.comp(draw, res2)

    # Run command passed on command line or otherwise run console.    
    cmds = sys.argv[1:]
    if cmds:
        c.batch_command(' '.join(cmds))
    else:
        print('Use "make recurse=1" or "parmake recurse=1" to make all.')
        c.compmake_console()
예제 #7
0
    def test_dynamic6(self):
        
        # first define with job and run
        mockup6(self.cc, both=True)
        db = self.db
        
        self.assertRaises(CompmakeBug, jobs_defined, job_id='hd', db=db)
        
        self.assert_cmd_success('make recurse=1')
        check_job_cache_state(job_id='hd', states=[Cache.DONE], db=db)
        self.assertEqual(jobs_defined(job_id='hd', db=db),
                         set(['hd-id']))
        
        # self.assert_cmd_success('graph compact=0 color=0 '
        #                         'cluster=1 filter=dot')
        
        self.assertJobsEqual('all', ['fd', 'fd-gd', 'fd-gd-g2',  
                                     'hd', 'hd-id', 'hd-id-i2', 
                                     'summary'])
        self.assertJobsEqual('done',  ['fd', 'fd-gd', 'fd-gd-g2',  
                                       'hd', 'hd-id', 'hd-id-i2', 
                                       'summary'])
        
        # now redo it 
        self.db = StorageFilesystem(self.root, compress=True)
        self.cc = Context(db=self.db)
        
        print('running again with both=False')
        mockup6(self.cc, both=False)
        clean_other_jobs(context=self.cc)
        
        self.assertJobsEqual('all', ['fd', 'fd-gd', 'fd-gd-g2', 
                                     'summary'])
        
        job=  get_job('summary', self.db)
        print('job.children: %s' % job.children)
        print('job.dynamic_children: %s' % job.dynamic_children)
        self.assertEqual(job.dynamic_children, {'fd': set(['fd-gd'])})
        self.assertEqualSet(direct_children('summary', self.db), ['fd', 'fd-gd'])
        self.assert_cmd_success('ls')

        self.assert_cmd_success('make recurse=1')
        self.assertJobsEqual('all',  ['fd', 'fd-gd', 'fd-gd-g2', 'summary'])
        self.assertJobsEqual('done', ['fd', 'fd-gd', 'fd-gd-g2', 'summary']) 
예제 #8
0
def f(x):
    print('f(x=%r)' % x)
    return x * 2


def schedule(context, params):
    print('schedule(context, params=%s)' % params.__repr__())
    for p in [42, 43, 44]:
        context.comp(f, x=p)


if __name__ == '__main__':
    from compmake import Context
    c = Context()
    c.comp_dynamic(schedule, params=[42, 43, 44])
    c.batch_command('clean;parmake echo=1 recurse=1')
예제 #9
0
from mycomputations import funcA, funcB, draw

if __name__ == '__main__':
    from compmake import Context
    context = Context()

    for param_a in [1, 2, 3]:
        for param_b in [10, 11, 12]:
            prefix = 'a%s-b%s' % (param_a, param_b)
            context.comp_prefix(prefix)

            # use job_id to override default naming
            res1 = context.comp(funcA, param_a, job_id='preparing')
            res2 = context.comp(funcB, res1, param_b, job_id='computing')
            context.comp(draw, res2, job_id='drawing')

    context.compmake_console()