From 053853c53dfcee14da810d67f3ee51e120db55fb Mon Sep 17 00:00:00 2001 From: Michael Skelton Date: Tue, 23 Oct 2018 22:25:56 +1000 Subject: [PATCH] [BREAK] Checkin --- Interlace/interlace.py | 10 +++++----- Interlace/lib/core/threader.py | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Interlace/interlace.py b/Interlace/interlace.py index f81a1c5..d5211cd 100644 --- a/Interlace/interlace.py +++ b/Interlace/interlace.py @@ -6,24 +6,24 @@ from lib.core.threader import Pool def build_queue(arguments, output): - queue = "" + queue = list() for target in InputHelper.process_targets(arguments): for command in InputHelper.process_commands(arguments): output.terminal(Level.VERBOSE, target, command, "Added to Queue") - queue += command + queue.append(command) return queue def main(): parser = InputParser() arguments = parser.parse(sys.argv[1:]) + output = OutputHelper(arguments) output.print_banner() - #pool = Pool(arguments.threads, ) - pool = build_queue(arguments, output) - print(pool) + pool = Pool(arguments.threads, build_queue(arguments, output), arguments.timeout, output) + pool.run() if __name__ == "__main__": diff --git a/Interlace/lib/core/threader.py b/Interlace/lib/core/threader.py index 497cbcc..1975383 100644 --- a/Interlace/lib/core/threader.py +++ b/Interlace/lib/core/threader.py @@ -23,12 +23,13 @@ class Worker(object): class Pool(object): - def __init__(self, max_workers, queue, timeout): + def __init__(self, max_workers, queue, timeout, output): self.queue = queue self.workers = [Worker(self) for w in range(max_workers)] self.timeout = timeout + self.output = output - def run(self, command): + def run(self): while True: # make sure resources are available