Ejemplo n.º 1
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()
Ejemplo n.º 2
0
    if param_b == 11:
        msg = 'Exception raised for b = %d.' % param_b
        raise Exception(msg)
    return res1 + param_a

def draw(res2):
    print('draw(%r)' % res2)
    pass

if __name__ == '__main__':
    from compmake import Context
    context = Context()
    
    for param_a in [1,2,3]:
        for param_b in [10,11,12]:
            context.comp_prefix('a%s-b%s' % (param_a, param_b))
            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')

    import sys
    if len(sys.argv) == 1:
        print('Presenting an interactive console')
        context.compmake_console()
    else:
        print('Running the computation in batch mode')
        cmd = " ".join(sys.argv[1:])
        try:
            context.batch_command(cmd)
        except Exception as e:
            print('Command failed: %s' % e)
Ejemplo n.º 3
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]:
            # Add a prefix to the job ids for easy reference 
            prefix = 'a%s-b%s' % (param_a, param_b)
            context.comp_prefix(prefix)

            res1 = context.comp(funcA, param_a)
            res2 = context.comp(funcB, res1, param_b)
            context.comp(draw, res2)

    context.compmake_console()

Ejemplo n.º 4
0
        msg = 'Exception raised for b = %d.' % param_b
        raise Exception(msg)
    return res1 + param_b


def draw(res2):
    print('draw(%r)' % res2)


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

    for param_a in [1, 2, 3]:
        for param_b in [10, 11, 12]:
            context.comp_prefix('a%s-b%s' % (param_a, param_b))
            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')

    import sys
    if len(sys.argv) == 1:
        print('Presenting an interactive console')
        context.compmake_console()
    else:
        print('Running the computation in batch mode')
        cmd = " ".join(sys.argv[1:])
        try:
            context.batch_command(cmd)
        except Exception as e:
            print('Command failed: %s' % e)