def main(): """ The main function Runs the selection pipeline. """ args = parse_arguments() config = parse_config(args) set_environment(config['environment']) logging.basicConfig(format='%(levelname)s %(asctime)s %(message)s', filename=args.log_file, filemode='w', level=args.level) check_paths(config) try: cores = int(config['system']['cores_avaliable']) except: logging.error("Could not read cores_avaliable from the config file") # TODO - add real error messages sys.exit(1) logging.info("Creating Job Queue") job_queue = JobQueue(cores) logging.info("Success") ngadnap_graph = CreateNGaDNAPGraph(args=args, config=config, job_queue=job_queue) job_queue.set_command_graph(ngadnap_graph.command_graph) ngadnap_graph.populate() ngadnap_graph.run() print("NGaDNAP ran successfully")
def test_basic_depends_on(self): q = JobQueue(1) g = CommandGraph(q) q.set_command_graph(g) c1 = CommandNode("sleep 1", "1") c2 = CommandNode("echo hello", "2", stdout="test.txt") g.add_node(command_node=c1, depends_on=[c2]) assert set(g.nodes()) == set(['1', '2']) g.start() g.finish_block() os.remove('test.txt')
def test_basic_depends_on(self): q = JobQueue(1) g = CommandGraph(q) q.set_command_graph(g) c1 = CommandNode("sleep 1", "1") c2 = CommandNode("echo hello", "2", stdout="test.txt") g.add_node(command_node=c1, depends_on=[c2]) assert set(g.nodes())== set(['1', '2']) g.start() g.finish_block() os.remove('test.txt')
def test_two_depends_on(self): q = JobQueue(1) g = CommandGraph(q) q.set_command_graph(g) c1 = CommandNode("sleep 1", "1") c2 = CommandNode("echo hello", "2", stdout="test.txt") c3 = CommandNode("echo hello", "3", stdout="test2.txt") g.add_node(command_node=c1, depends_on=[c3, c2]) g.add_node(command_node=c3, depends_on=[c2]) g.start() g.finish_block() os.remove("test.txt") os.remove("test2.txt")
def test_two_depends_on(self): q = JobQueue(1) g = CommandGraph(q) q.set_command_graph(g) c1 = CommandNode("sleep 1", "1") c2 = CommandNode("echo hello", "2", stdout="test.txt") c3 = CommandNode("echo hello", "3", stdout="test2.txt") g.add_node(command_node=c1, depends_on=[c3,c2]) g.add_node(command_node=c3, depends_on=[c2]) g.start() g.finish_block() os.remove("test.txt") os.remove("test2.txt")