Пример #1
0
    def test_dynamic8_clean(self):
        #         """ Re-execution creates more jobs.  """
        mockup8(self.cc)
        # run it
        TestDynamic8.define_other = True
        self.assert_cmd_success('make recurse=1')
        # we have three jobs defined
        self.assertJobsEqual('all', ['fd', 'fd-always', 'fd-other'])
        # clean and remake fd
        TestDynamic8.define_other = False

        self.assertJobsEqual('done', ['fd', 'fd-always', 'fd-other'])
        self.assertEqualSet(jobs_defined('fd', self.db),
                            ['fd-always', 'fd-other'])

        self.assertEqualSet(definition_closure(['fd'], self.db),
                            ['fd-always', 'fd-other'])
        direct = direct_uptodate_deps_inverse('fd', self.db)
        self.assertEqualSet(direct, ['fd-always', 'fd-other'])
        direct_closure = direct_uptodate_deps_inverse_closure('fd', self.db)
        self.assertEqualSet(direct_closure, ['fd-always', 'fd-other'])

        self.assert_cmd_success('clean fd')
        # clean should get rid of the jobs
        self.assertJobsEqual('all', ['fd'])
        self.assert_cmd_success('make fd')
        # now the "other" job should disappear
        self.assertJobsEqual('all', ['fd', 'fd-always'])
Пример #2
0
    def test_dynamic8_clean(self):
#         """ Re-execution creates more jobs.  """ 
        mockup8(self.cc)
        # run it
        TestDynamic8.define_other = True
        self.assert_cmd_success('make recurse=1')
        # we have three jobs defined
        self.assertJobsEqual('all', ['fd', 'fd-always', 'fd-other'])
        # clean and remake fd
        TestDynamic8.define_other = False
                
        self.assertJobsEqual('done', ['fd', 'fd-always', 'fd-other'])
        self.assertEqualSet(jobs_defined('fd', self.db),                              ['fd-always', 'fd-other'])
        
        
        self.assertEqualSet(definition_closure(['fd'], self.db), ['fd-always', 'fd-other'])
        direct = direct_uptodate_deps_inverse('fd', self.db)
        self.assertEqualSet(direct, ['fd-always', 'fd-other'])
        direct_closure = direct_uptodate_deps_inverse_closure('fd', self.db)
        self.assertEqualSet(direct_closure, ['fd-always', 'fd-other'])
        
        self.assert_cmd_success('clean fd')
        # clean should get rid of the jobs
        self.assertJobsEqual('all', ['fd'])
        self.assert_cmd_success('make fd')
        # now the "other" job should disappear
        self.assertJobsEqual('all', ['fd', 'fd-always'])
Пример #3
0
    def job_succeeded(self, job_id):
        """ Mark the specified job as succeeded. Update the structures,
            mark any parents which are ready as ready_todo. """
        self.log('job_succeeded', job_id=job_id)
        self.check_invariants()
        publish(self.context, 'manager-job-succeeded', job_id=job_id)
        assert job_id in self.processing

        self.processing.remove(job_id)
        del self.processing2result[job_id]
        self.done.add(job_id)

        # parent_jobs = set(direct_parents(job_id, db=self.db))
        from compmake.jobs.uptodate import direct_uptodate_deps_inverse
        parent_jobs = direct_uptodate_deps_inverse(job_id, db=self.db)
        cq = CacheQueryDB(self.db)

        parents_todo = set(self.todo & parent_jobs)
        self.log('considering parents', parents_todo=parents_todo)
        for opportunity in parents_todo:
            # print('parent %r in todo' % (opportunity))
            if opportunity in self.processing:
                msg = 'Parent %r of %r already processing' % (
                    opportunity, job_id)
                if CompmakeConstants.try_recover:
                    print(msg)
                    continue
                else:
                    raise CompmakeBug(msg)
            assert opportunity not in self.processing

            self.log('considering opportuniny', opportunity=opportunity,
                     job_id=job_id)

            its_children = direct_children(opportunity, db=self.db)
            # print('its children: %r' % its_children)

            for child in its_children:
                # If child is part of all_targets, check that it is done
                # otherwise check that it is done by the DB.
                if child in self.all_targets:
                    if not child in self.done:
                        self.log('parent still waiting another child',
                                 opportunity=opportunity,
                                 child=child)
                        # logger.info('parent %r still waiting on %r' %
                        # (opportunity, child))
                        # still some dependency left
                        break
                else:
                    up, _, _ = cq.up_to_date(child)
                    if not up:
                        # print('The child %s is not up_to_date' % child)
                        break

            else:
                # print('parent %r is now ready' % (opportunity))
                self.log('parent is ready', opportunity=opportunity)
                self.todo.remove(opportunity)
                self.ready_todo.add(opportunity)

        self.check_invariants()
        self.publish_progress()
Пример #4
0
    def job_succeeded(self, job_id):
        """ Mark the specified job as succeeded. Update the structures,
            mark any parents which are ready as ready_todo. """
        self.log('job_succeeded', job_id=job_id)
        self.check_invariants()
        publish(self.context, 'manager-job-succeeded', job_id=job_id)
        assert job_id in self.processing

        self.processing.remove(job_id)
        del self.processing2result[job_id]
        self.done.add(job_id)

        # parent_jobs = set(direct_parents(job_id, db=self.db))
        from compmake.jobs.uptodate import direct_uptodate_deps_inverse
        parent_jobs = direct_uptodate_deps_inverse(job_id, db=self.db)
        cq = CacheQueryDB(self.db)

        parents_todo = set(self.todo & parent_jobs)
        self.log('considering parents', parents_todo=parents_todo)
        for opportunity in parents_todo:
            # print('parent %r in todo' % (opportunity))
            if opportunity in self.processing:
                msg = 'Parent %r of %r already processing' % (opportunity,
                                                              job_id)
                if CompmakeConstants.try_recover:
                    print(msg)
                    continue
                else:
                    raise CompmakeBug(msg)
            assert opportunity not in self.processing

            self.log('considering opportuniny',
                     opportunity=opportunity,
                     job_id=job_id)

            its_children = direct_children(opportunity, db=self.db)
            # print('its children: %r' % its_children)

            for child in its_children:
                # If child is part of all_targets, check that it is done
                # otherwise check that it is done by the DB.
                if child in self.all_targets:
                    if not child in self.done:
                        self.log('parent still waiting another child',
                                 opportunity=opportunity,
                                 child=child)
                        # logger.info('parent %r still waiting on %r' %
                        # (opportunity, child))
                        # still some dependency left
                        break
                else:
                    up, _, _ = cq.up_to_date(child)
                    if not up:
                        # print('The child %s is not up_to_date' % child)
                        break

            else:
                # print('parent %r is now ready' % (opportunity))
                self.log('parent is ready', opportunity=opportunity)
                self.todo.remove(opportunity)
                self.ready_todo.add(opportunity)

        self.check_invariants()
        self.publish_progress()