Example #1
0
    def test_compute_does_not_unload_from_memory(self):
        storage = StorageFactory().get_storage('dict_storage')

        storage.write_table(table_name='tests',
                            table_data={
                                "a_dependent_variable": array([1, 5, 1000]),
                                "id": array([1, 3, 4])
                            })

        dataset = Dataset(in_storage=storage,
                          in_table_name='tests',
                          id_name="id",
                          dataset_name="tests")

        values = dataset.get_attribute("a_dependent_variable")
        self.assert_(
            "a_dependent_variable" in dataset.get_attributes_in_memory())
        dataset.compute_variables("opus_core.tests.a_test_variable")
        self.assert_(
            "a_dependent_variable" in dataset.get_attributes_in_memory())
        self.assert_("a_test_variable" in dataset.get_attributes_in_memory())
        # The type of values will be int32 on a 32-bit machine, and int64 on a 64 bit machine
        if platform.architecture()[0] == '64bit':
            self.assertEqual(values.dtype.type, int64)
        else:
            self.assertEqual(values.dtype.type, int32)
Example #2
0
 def test_compute_unloads_from_memory(self):
     
     storage = StorageFactory().get_storage('dict_storage')
     
     storage.write_table(
         table_name='tests',
         table_data={
             'a_dependent_variable':array([1,5,10]),
             'id':array([1,3,4])
             }
         )
     
     dataset = Dataset(in_storage=storage, in_table_name='tests', id_name='id', dataset_name='tests')
     
     SessionConfiguration(in_storage=storage)["flush_variables"] = True
     dataset.get_attribute("a_dependent_variable")
     self.assert_("a_dependent_variable" in dataset.get_attributes_in_memory())
     dataset.compute_variables("opus_core.tests.a_test_variable")
     self.assert_("a_dependent_variable" not in dataset.get_attributes_in_memory())
     self.assert_("a_test_variable" in dataset.get_attributes_in_memory())
     SimulationState().remove_singleton(delete_cache=True)
Example #3
0
 def test_compute_does_not_unload_from_memory(self):        
     storage = StorageFactory().get_storage('dict_storage')
     
     storage.write_table(
         table_name='tests',
         table_data={
             "a_dependent_variable":array([1,5,1000]),
             "id":array([1,3,4])
             }
         )
     
     dataset = Dataset(in_storage=storage, in_table_name='tests', id_name="id", dataset_name="tests")
     
     values = dataset.get_attribute("a_dependent_variable")
     self.assert_("a_dependent_variable" in dataset.get_attributes_in_memory())
     dataset.compute_variables("opus_core.tests.a_test_variable")
     self.assert_("a_dependent_variable" in dataset.get_attributes_in_memory())
     self.assert_("a_test_variable" in dataset.get_attributes_in_memory())
     # The type of values will be int32 on a 32-bit machine, and int64 on a 64 bit machine
     if platform.architecture()[0]=='64bit':
         self.assertEqual(values.dtype.type, int64)
     else:
         self.assertEqual(values.dtype.type, int32)
Example #4
0
    def test_compute_unloads_from_memory(self):

        storage = StorageFactory().get_storage('dict_storage')

        storage.write_table(table_name='tests',
                            table_data={
                                'a_dependent_variable': array([1, 5, 10]),
                                'id': array([1, 3, 4])
                            })

        dataset = Dataset(in_storage=storage,
                          in_table_name='tests',
                          id_name='id',
                          dataset_name='tests')

        SessionConfiguration(in_storage=storage)["flush_variables"] = True
        dataset.get_attribute("a_dependent_variable")
        self.assert_(
            "a_dependent_variable" in dataset.get_attributes_in_memory())
        dataset.compute_variables("opus_core.tests.a_test_variable")
        self.assert_(
            "a_dependent_variable" not in dataset.get_attributes_in_memory())
        self.assert_("a_test_variable" in dataset.get_attributes_in_memory())
        SimulationState().remove_singleton(delete_cache=True)