Пример #1
0
 def _publishDependentCell(self, block_id):
     low, high = self._biigraph._get_range_block(block_id)
     count = 0
     d = self.lbcn
     bcn = d[block_id]
     brl = self._getBlockBRL(bcn)
     for row in range(low, high + 1):
         r = SimpleCell(d[block_id])
         r.root = ID((0, bcn.block_name[-1:], 0))
         deps = DependencySet()
         dep_table = BlockVersionTable()
         for block in range(block_id):
             time = self._biigraph._get_dep_elem_offset(row, block)
             if time != -1:
                 deps.add_implicit(d[block])
                 dep_table[d[block].block_name] = \
                    BlockVersion(self._getBlockBRL(d[block]), time)
         r.dependencies = deps
         pack = PublishRequest(BlockVersion(brl, count - 1))
         pack.tag = STABLE
         count += 1
         pack.cells.append(r)
         pack.contents[r.name.cell_name] = Content(
             id_=None, load=Blob('hola {0}'.format(r.name.cell_name)))
         pack.deptable = dep_table
         self.service.publish(pack)
Пример #2
0
 def deps(self, files=None):
     deps = DependencySet()
     for name, (cell, _) in self._resources.iteritems():
         if files is None or self.block_name + name in files:
             if isinstance(cell, SimpleCell):
                 deps.update(cell.dependencies)
     return deps
Пример #3
0
 def _publishDependentCell(self, block_id):
     low, high = self._biigraph._get_range_block(block_id)
     count = 0
     d = self.lbcn
     bcn = d[block_id]
     brl = self._getBlockBRL(bcn)
     for row in range(low, high + 1):
         r = SimpleCell(d[block_id])
         r.root = ID((0, bcn.block_name[-1:], 0))
         deps = DependencySet()
         dep_table = BlockVersionTable()
         for block in range(block_id):
             time = self._biigraph._get_dep_elem_offset(row, block)
             if time != -1:
                 deps.add_implicit(d[block])
                 dep_table[d[block].block_name] = \
                    BlockVersion(self._getBlockBRL(d[block]), time)
         r.dependencies = deps
         pack = PublishRequest(BlockVersion(brl, count - 1))
         pack.tag = STABLE
         count += 1
         pack.cells.append(r)
         pack.contents[r.name.cell_name] = Content(id_=None, load=Blob('hola {0}'.
                                                             format(r.name.cell_name)))
         pack.deptable = dep_table
         self.service.publish(pack)
Пример #4
0
 def deps(self, files=None):
     deps = DependencySet()
     for name, (cell, _) in self._resources.iteritems():
         if files is None or self.block_name + name in files:
             if isinstance(cell, SimpleCell):
                 deps.update(cell.dependencies)
     return deps
Пример #5
0
    def test_dependency_set(self):
        d1 = DependencySet()
        d1.add_implicit(BlockCellName("user/block/path/file2.h"))
        d1.add_implicit(BlockCellName("user/block/path/file3.h"))
        d1.add_implicit(BlockCellName("user/block/path/file4.h"))
        names = set()
        names.add(CPPDeclaration("iostream.h"))
        d1.update_declarations(names)

        s = d1.serialize()
        d2 = DependencySet.deserialize(s)
        self.assert_bii_equal(d1, d2)
    def test_dependency_set(self):
        d1 = DependencySet()
        d1.add_implicit(BlockCellName("user/block/path/file2.h"))
        d1.add_implicit(BlockCellName("user/block/path/file3.h"))
        d1.add_implicit(BlockCellName("user/block/path/file4.h"))
        names = set()
        names.add(CPPDeclaration("iostream.h"))
        d1.update_declarations(names)

        s = d1.serialize()
        d2 = DependencySet.deserialize(s)
        self.assert_bii_equal(d1, d2)
Пример #7
0
    def test_performance_breadth(self):
        store = MongoServerStore(self.conn, self.__class__.__name__)
        store.create_user(User("user2"))
        publisher = TestPublisher("user2", store)
        brl_block = BRLBlock('user2/user2/block/master')

        count = 1000
        resource_info = {}
        for i in xrange(count):
            deps = DependencySet()
            if i > 0:
                deps = DependencySet()
                for j in range(max(0, i - 25), i):
                    deps.explicit.add(BlockCellName('user2/block/cell%d.h' %
                                                    j))
                    deps.resolved.add(
                        CPPDeclaration('user2/block/cell%d.h' % j))
                deps.unresolved.add(CPPDeclaration('path/to/file.h'))
                deps.implicit.add(BlockCellName('user2/block/cell%d.h' % j))
            resource_info['cell%d.h' % i] = 'content %d' % i, deps
        publisher.publish(brl_block, resource_info)

        timer = self.get_timer()
        start_time = timer()

        store = MemServerStore(store)
        #print 'MEMSTORE SIZE 0', asizeof(store) / 1000000.0

        translator = ReferenceTranslatorService(store, "user2")
        version = BlockVersion(brl_block, 0)
        missing = References()
        missing[version].add('cell%d.h' % (count - 1))
        closure = CompatibilityClosure(missing)
        full_graph = BlockVersionGraph()
        full_graph.add_nodes([version])
        build_compatibility_closure(translator, closure, [version], full_graph)

        elapsed_time = timer() - start_time
        #print 'Closure time', elapsed_time

        #print 'CLOSURE SIZE ', asizeof(closure) / 1000000.0
        #print 'MEMSTORE SIZE ', asizeof(store) / 1000000.0
        # print 'MINCELLS SIZE ', asizeof(store.min_cells)/1000000.0

        self.assertEqual({brl_block.block_name + c
                          for c in resource_info}, closure.block_cell_names)
        self.assertLess(elapsed_time, 7)
Пример #8
0
 def deserialize(data):
     if data is None:
         return None
     r = SimpleCell(None)
     r.dependencies = DependencySet.deserialize(data[SimpleCell.SERIAL_DEPENDENCES_KEY])
     container = data[SimpleCell.SERIAL_CONTAINER_KEY]
     if container:
         r.container = BlockCellName(container)
     return r
Пример #9
0
    def update_test(self):
        deps = DependencySet()
        brl1 = BlockCellName("user/module/mytest.h")
        dec = CPPDeclaration("name1")
        deps.unresolved.add(brl1)
        deps.explicit.add(brl1)
        deps.resolved.add(dec)

        deps2 = DependencySet()
        brl2 = BlockCellName("user/module/mytest2.h")
        dec2 = CPPDeclaration("name2")
        deps2.unresolved.add(brl2)
        deps2.explicit.add(brl2)
        deps2.resolved.add(dec2)

        deps.update(deps2)
        self.assertIn(brl1, deps.unresolved)
        self.assertIn(brl1, deps.explicit)
        self.assertIn(dec, deps.resolved)
        self.assertIn(brl2, deps.unresolved)
        self.assertIn(brl2, deps.explicit)
        self.assertIn(dec2, deps.resolved)
Пример #10
0
 def clean_metadata(self):
     super(SimpleCell, self).clean_metadata()
     self.dependencies = DependencySet()
     self.container = None
Пример #11
0
 def __init__(self, name, biitype=UNKNOWN):
     super(SimpleCell, self).__init__(name)
     self.dependencies = DependencySet()
     self.dependencies.cell_name = self.name
     self.container = None  # CellID or BlockCellName (of the virtual resource)
     self.type = BiiType(biitype)