예제 #1
0
def Worker((prefix, state_index)):
    worker_state = WorkerState(prefix)

    try:
        dfa_traversal.TraverseTree(
            dfa.states[state_index],
            final_callback=worker_state.ReceiveInstruction,
            prefix=prefix)
    finally:
        worker_state.Finish()

    return prefix, worker_state.total_instructions
예제 #2
0
def Worker((prefix, state_index)):
    worker_state = WorkerState(prefix, worker_validator)

    try:
        dfa_traversal.TraverseTree(
            dfa.states[state_index],
            final_callback=worker_state.ReceiveInstruction,
            prefix=prefix,
            anyfield=0)
    except Exception as e:
        traceback.print_exc(
        )  # because multiprocessing imap swallows traceback
        raise

    return (prefix, worker_state.total_instructions, worker_state.num_valid)
예제 #3
0
def Worker((dfa_prefix, dfa_state_index)):
    """Traverse a portion of the DFA, and compute the associated subtrie."""
    worker_state = WorkerState(worker_validator)

    try:
        dfa_traversal.TraverseTree(
            dfa.states[dfa_state_index],
            final_callback=worker_state.ReceiveInstruction,
            prefix=dfa_prefix,
            anyfield=0)

    except Exception:
        traceback.print_exc(
        )  # because multiprocessing imap swallows traceback
        raise

    worker_state.sub_trie = worker_state.node_cache.Merge(
        worker_state.node_cache.empty_node, worker_state.sub_trie)

    return (worker_state.total_instructions, worker_state.num_valid,
            worker_state.sub_trie)