Example #1
0
    parser.description = desc
    parser.add_argument('-r', action='store_true', help='search recursivly')
    parser.add_argument('-d', action='store_true', help='show which simulations are not done')
    parser.add_argument(dest='stub', default=None, nargs='?', help='regex for system searching')
    return parser

def get_arguments(args=None):
    parser = create_parser()
    opts = parser.parse_args(args)
    return opts

def indent(string, level=0, **kwargs):
    print '    ' * level + string.format(ccodes=ccodes, **kwargs)

format_string = '(' + ccodes.f('path'   ) + '='  + ccodes.y('{path}'      ) + ') : ' + \
                '(' + ccodes.f('cstep'  ) + '='  + ccodes.c('{cstep:>8}'  ) + ') : ' + \
                '(' + ccodes.f('tstep'  ) + '='  + ccodes.c('{tstep:>8}'  ) + ') : ' + \
                '(' + ccodes.f('percent') + '='  + ccodes.c('{percent:>6}') + ') : ' + \
                '(' + ccodes.f('done'   ) + '='  +          '{done}'        + ')'

def get_cstep(obj):
    try:
        cstep = obj['current.step']
    except:
        cstep = None
    return cstep

def get_tstep(obj):
    try:
        tstep = obj['iterations.real']
    except:
Example #2
0
                        nargs='?',
                        help='regex for system searching')
    return parser


def get_arguments(args=None):
    parser = create_parser()
    opts = parser.parse_args(args)
    return opts


def indent(string, level=0, **kwargs):
    print '    ' * level + string.format(ccodes=ccodes, **kwargs)

format_string = '(' + ccodes.f('path'   ) + '='  + ccodes.y('{path}'      ) + ') : ' + \
                '(' + ccodes.f('cstep'  ) + '='  + ccodes.c('{cstep:>8}'  ) + ') : ' + \
                '(' + ccodes.f('tstep'  ) + '='  + ccodes.c('{tstep:>8}'  ) + ') : ' + \
                '(' + ccodes.f('percent') + '='  + ccodes.c('{percent:>6}') + ') : ' + \
                '(' + ccodes.f('done'   ) + '='  +          '{done}'        + ')'


def get_cstep(obj):
    try:
        cstep = obj['current.step']
    except:
        cstep = None
    return cstep


def get_tstep(obj):
    try:
Example #3
0
        part_id = lm.regex.part(part_relpath)
        new_part = os.path.join(os.path.dirname(part), 'part.%d' % (part_id + 1))

        if os.path.exists(new_part):
            print ccodes.red('error:') + ' ' + ccodes.blue('part already exists?') + ' ' + \
                ccodes.blue(os.path.relpath(new_part, work))
            errors += 1
            continue

        if opts.ok:
            os.mkdir(new_part)
            chk.save(os.path.join(new_part, 'sim.inp'))

        new_parts.append(new_part)

        print '       ' + ccodes.cyan(os.path.relpath(new_part, work)) + ' ' + \
            '(' + 'current.step=' + ccodes.cyan('%d' % cstep) + ')' + ' ' + \
            '(' + 'iterations.real=' + ccodes.cyan('%d' % tstep) + ')' + ' ' + \
            '(' + 'iterations.print=' + ccodes.cyan('%d' % pstep) + ')'

    print ''
    print 'old sims:', ccodes.c('%d' % len(parts))
    print 'new sims:', ccodes.c('%d' % len(new_parts))
    print 'errors  :', ccodes.c('%d' % errors)

    if not opts.ok:
        print ''
        print ccodes.r('warning: nothing was done, use --ok to turn off dry run')
    else:
        if new_parts:
            lm.common.command_script(new_parts, name=opts.name, stub=opts.stub)
Example #4
0
                                'part.%d' % (part_id + 1))

        if os.path.exists(new_part):
            print ccodes.red('error:') + ' ' + ccodes.blue('part already exists?') + ' ' + \
                ccodes.blue(os.path.relpath(new_part, work))
            errors += 1
            continue

        if opts.ok:
            os.mkdir(new_part)
            chk.save(os.path.join(new_part, 'sim.inp'))

        new_parts.append(new_part)

        print '       ' + ccodes.cyan(os.path.relpath(new_part, work)) + ' ' + \
            '(' + 'current.step=' + ccodes.cyan('%d' % cstep) + ')' + ' ' + \
            '(' + 'iterations.real=' + ccodes.cyan('%d' % tstep) + ')' + ' ' + \
            '(' + 'iterations.print=' + ccodes.cyan('%d' % pstep) + ')'

    print ''
    print 'old sims:', ccodes.c('%d' % len(parts))
    print 'new sims:', ccodes.c('%d' % len(new_parts))
    print 'errors  :', ccodes.c('%d' % errors)

    if not opts.ok:
        print ''
        print ccodes.r(
            'warning: nothing was done, use --ok to turn off dry run')
    else:
        if new_parts:
            lm.common.command_script(new_parts, name=opts.name, stub=opts.stub)