예제 #1
0
    def __init__(self,
                 build_manager,
                 jobs=0,
                 keep_going=False,
                 with_backtrace=True,
                 use_sqlite=False,
                 force_lock=False):

        self.vfiles = _VFiles(use_sqlite=use_sqlite, force_lock=force_lock)
        self.building_nodes = {}
        self.expensive_nodes = set(build_manager._expensive_nodes)
        self.build_manager = build_manager

        tm = TaskManager()

        if self.expensive_nodes:
            tm.enable_expensive()

        if not keep_going:
            tm.disable_keep_going()

        if not with_backtrace:
            tm.disable_backtrace()

        tm.start(jobs)

        self.task_manager = tm
예제 #2
0
    def __init__(self, build_manager,
                 jobs=0, keep_going=False, with_backtrace=True,
                 use_sqlite=False, force_lock=False):

        self.vfiles = _VFiles(use_sqlite=use_sqlite, force_lock=force_lock)
        self.building_nodes = {}
        self.expensive_nodes = set(build_manager._expensive_nodes)
        self.build_manager = build_manager

        tm = TaskManager()

        if self.expensive_nodes:
            tm.enable_expensive()

        if not keep_going:
            tm.disable_keep_going()

        if not with_backtrace:
            tm.disable_backtrace()

        tm.start(jobs)

        self.task_manager = tm
예제 #3
0
    def test_tm_expensive_keep_going(self):

        expensive_event = threading.Event()

        num_tasks = 8
        jobs = 16

        tm = TaskManager()
        tm.disable_backtrace()

        for i in range(num_tasks):
            tm.add_task(0, i, _do_non_expensive, expensive_event)

        tm.add_task(0, num_tasks, _do_fail, 1)

        tm.start(jobs)
        time.sleep(0.25)

        tm.add_expensive_task(num_tasks + 1, _do_expensive, expensive_event)

        results = self.get_done_tasks(tm)

        self.assertEqual(len(results), num_tasks + 2)
예제 #4
0
    def test_tm_expensive_keep_going(self):

        expensive_event = threading.Event()

        num_tasks = 8
        jobs = 16

        tm = TaskManager()
        tm.disable_backtrace()

        for i in range(num_tasks):
            tm.add_task(0, i, _do_non_expensive, expensive_event)

        tm.add_task(0, num_tasks, _do_fail, 1)

        tm.start(jobs)
        time.sleep(0.25)

        tm.add_expensive_task(num_tasks + 1, _do_expensive, expensive_event)

        results = self.get_done_tasks(tm)

        self.assertEqual(len(results), num_tasks + 2)