def component(df, bill_components): #df = component_type(df, bill_components) df = connection_type(df, bill_components) df = end_forms(df, bill_components) df = sleeve.sleeve(df, bill_components, comp_sleeve) df = adaptor.adaptor(df, bill_components, comp_adaptor) df = boss.boss(df, bill_components, comp_boss) df = elbow.elbow(df, bill_components, comp_elbow) df = float_.float_(df, bill_components, comp_float) df = hfl.hfl(df, bill_components, comp_hfl) df = nut.nut(df, bill_components, comp_nut) #df = other.other(df, bill_components, comp_other) df = straight.straight(df, bill_components, comp_straight) df = tee.tee(df, bill_components, comp_tee) df = threaded.threaded(df, bill_components, comp_threaded) return df
return True def all_entries(year, offset=1): failed = 0 for num in count(offset): if not get_entry(year, num): failed += 1 else: failed = 0 if failed > FAILURES: break def all_years(): for year in range(2009, 2014): all_entries(year) if __name__ == '__main__': make_session() p = OptionParser() p.add_option("--year", dest="year", type=int, default=None) options, args = p.parse_args() if options.year: all_entries(options.year) else: threaded(range(2009, 2014), all_entries)
import time import sys import sequential import threaded import multiproc if __name__ == "__main__": type = sys.argv[1] start = time.time() if type == 'sequential': sequential.sequential(80) elif type == 'threaded': threaded.threaded(80) elif type == 'threaded_delay': threaded.threaded_delay(80) elif type == 'multiproc': multiproc.multiproc(80) end = time.time() print("took: ", end - start)
def parse_threaded(engine): def fnc(p): parse_tender(engine, p) threaded(traverse_local(), fnc, num_threads=10)