コード例 #1
0
ファイル: MakeAllImages.py プロジェクト: nico202/pyNeMo
    parser.add_argument('--cores',
                        help = 'Number of cores to use. All by default'
                        , dest = 'cores'
                        , default = get_cores()
    )
  
    args = parser.parse_args()
    path = args.path

    #Read ANALYSIS file
    fname = args.analysis_file
    with open(fname) as f:
        content = f.readlines()

    cprint("Total files provided: %s; Number of cores: %s" % (len(content), args.cores), 'info')
    is_folder(args.images_path)

    real_content = []
#    existing = listdir(args.images_path) #Slower than isfile
    for line in content:
        file_data = line.split(",")
        general = file_data[0]
        config = file_data[1]
        if args.run_all or (file_data[2] == "1" == file_data[7]):
            filename = "%s_%s.png" % (general, config)
            if not isfile("./%s" % args.images_path + filename):
           # if filename not in existing: #Slower than isfile O.o
                real_content.append((args.path, args.images_path, general, config))
#            else: existing.remove(filename)

    dispatch_jobs(real_content, int(args.cores), main_loop, False) #Ugly, ya'know
コード例 #2
0
ファイル: Batch.py プロジェクト: nico202/pyNeMo
    return substituteRanges(commands, commands)

commands = substituteRanges([args], [])

#fix parentheses:
commands = [ i for i in commands if not missing(i) ]

#set just to be sure no duplicate runs
real_commands = set(commands)

#TODO:
#FIXME: remove "--show-image" etc to prevent different hashes of same config
session_hash = hashDict(real_commands)

#Save commands list
is_folder("./commands")
commands_file = "./commands/" + session_hash + "_commands"
cprint ("Saving %s commands to file: %s" % (len(real_commands), commands_file), 'info')
saveKey(commands_file, commands)
# Debug: re-enable in release
# cprint("Running in 5s", "warning")
# time.sleep(5)

#Start
is_folder (output_dir)

cprint("We'll use %s as output dir" % (output_dir), 'info')

#Let's run the simulations (surely not the best way, but does the job)
#TODO: add the loop inside Runner?
start = time.time()