def failed_jsons_test(input_folder_path, output_folder_path, trace): json_files = [ f for f in os.listdir(input_folder_path) if isfile(join(input_folder_path, f)) and not f.startswith(".") ] for file_name in json_files: print("...processing:", file_name) trace(input_folder_path + file_name, output_folder_path) print("successed:", file_name)
def timer(func, *pargs, **kargs): _reps = kargs.pop('_reps', 1000) trace(func, pargs, kargs) repslist = range(_reps) start = timefunc() for i in repslist: ret = func(*pargs, **kargs) elapsed = timefunc() - start return (elapsed, ret)
def main(argv): """The main entry point for frontends to use""" parser = get_parser() opts = parser.parse_args(argv) if opts.trace: return trace(_main, parser, opts) if opts.profile: return profile(_main, parser, opts) return _main(parser, opts)
def __init__(self, tracefile): self._trace = trace(tracefile) self.total_time = self._trace.total_time self.comm_hashmap = [ {} for i in range(self._trace.tasks) ] self.mpi_init_hashmap = [ {} for i in range(self._trace.tasks) ] self.mpi_fini_hashmap = [ {} for i in range(self._trace.tasks) ] self.callstack_pool = [ {} for i in range(self._trace.tasks) ] self.mpi_opened = [ False for i in range(self._trace.tasks) ] self.burst_last = [ None for i in range(self._trace.tasks) ] self.callstack_last = [ None for i in range(self._trace.tasks) ] self.loop_stack = [ [] for i in range(self._trace.tasks) ] self.mpi_acumm_cycles = [ {} for i in range(self._trace.tasks) ] self.mpi_acumm_instr = [ {} for i in range(self._trace.tasks) ] self.mpi_acumm_ld_instr = [ {} for i in range(self._trace.tasks) ]
def flow_errors(G, src, ud=None, stopnodes=None): """Returns the first edges that do not conform to the flow direction implicit in defined source node. G: target digraph src: source nodes ud: undirected graph (faster iteration with setdirection) stopnodes: break points in the network """ if not ud: ud = G.to_undirected() badedges = [] gnodes = trace(G, src, stopnodes) connected = G.edges(dfs_tree(ud, src).nodes()) for edge in connected: start = edge[0] end = edge[1] if end in gnodes and start not in gnodes: badedges.append(G.edges(start)[0]) return badedges
# run the new command using the given tracer tracer.run('main(args)') # make a report, placing output in the current directory r = tracer.results() r.write_results(show_missing=True, coverdir="coverage") if __name__ == '__main__': args = config() if args.custom: sys.ps1 = "fractal> " sys.ps2 = " ... " banner = dedent(""" ┌────────────────────────────────────────────────────────────────────┐ │ *** Define a custom ℂ🠖ℕ function named 'fractal()' *** │ │ You may inspect or modify the command-line parameters 'args' │ │ ... when complete, press Ctrl-D to save function and exit │ └────────────────────────────────────────────────────────────────────┘ """) exitmsg = "--- Using function 'fractal()' to generate image ---" args.kind = "fractal" code.interact(banner=banner, local=globals(), exitmsg=exitmsg) args.fn = eval(args.kind) if args.trace: trace(args) else: main(args)
def set_trace_doctest(stdin=sys.stdin, stdout=sys.stdout, trace=pdb.set_trace): sys.stdin = stdin sys.stdout = stdout trace()