Пример #1
0
def run(instruction_file):
    with open(instruction_file) as f:
        instruction_dict = json.load(f)
        instruction = Instruction.from_dict(instruction_dict)

    if (len(instruction.pages) <= 10 or instruction.multi_thread == False):
        capture(instruction)
    else:
        processes = []
        chunkedPages = chunks(
            instruction.pages,
            math.ceil(len(instruction.pages) / instruction.max_threads))

        for chunk in chunkedPages:
            customInstruction = instruction
            customInstruction.pages = chunk

            p = Process(target=capture, args=(customInstruction, ))
            p.start()
            processes.append(p)

        for process in processes:
            process.join()
Пример #2
0
def run(instruction_file):
    with open(instruction_file) as f:
        instruction_dict = json.load(f)
        instruction = Instruction.from_dict(instruction_dict)

    links(instruction)