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')
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')
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')
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')
def generate_tests(context, values): res = [] for v in values: res.append(context.comp(func1, v)) return context.comp(summary, res) def summary(results): print('I finished with this: %s' % results) if __name__ == '__main__': from compmake import Context c = Context() values = c.comp(cases) # comp_dynamic gives the function an extra argument # "context" to further define jobs c.comp_dynamic(generate_tests, values) # Run command passed on command line or otherwise run console. import sys cmds = sys.argv[1:] if cmds: c.batch_command(' '.join(cmds)) else: print('Use "make recurse=1" (or "parmake") to make all.') c.compmake_console()
#!/usr/bin/env python # -*- coding: utf-8 -*- if __name__ == '__main__': from compmake import Context c = Context() from example_external_support import generate_tests, cases values = c.comp(cases) # comp_dynamic gives the function an extra argument # "context" to further define jobs c.comp_dynamic(generate_tests, values) # Run command passed on command line or otherwise run console. import sys 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()
def f(x): print('f(x=%r)' % x) return x * 2 def statistics(res): print('statistics(res=%s)' % res.__repr__()) return sum(res) def schedule(context, params): print('schedule(context, params=%s)' % params.__repr__()) jobs = [context.comp(f, x=p) for p in params] summary = context.comp(statistics, jobs) # returns a job "promise", not a value! return summary def report(summary): print('report(summary=%r)' % summary) if __name__ == '__main__': from compmake import Context c = Context() summary = c.comp_dynamic(schedule, [42, 43, 44]) c.comp(report, summary) c.batch_command('clean;parmake echo=1 recurse=1')
from filesystem import list_categories from instancing import instance_categories import os if __name__ == '__main__': # Get the full path to the dataset dataset = os.path.realpath('101_ObjectCategories') output = os.path.realpath('out') from compmake import Context context = Context() categories = context.comp(list_categories, dataset) context.comp_dynamic(instance_categories, categories, output) import sys cmds = sys.argv[1:] if cmds: context.batch_command(" ".join(cmds)) else: context.compmake_console()