示例#1
0
    def save(self):
        log_it("SAVE DATA (JSON) ON DATA WAREHOUSE: {}".format(self.slug),
               "bin-mining")
        data = {'data': self.pdict, 'columns': self.keys}
        DW = DataWarehouse()
        DW.save(self.slug, data)

        self.cube['status'] = True
        self.cube['lastupdate'] = datetime.now()
        self.cube['run'] = True
        self.mongo['cube'].update({'slug': self.cube['slug']}, self.cube)

        log_it("CLEAN MEMORY: {}".format(self.slug), "bin-mining")
        gc.collect()
 def test_save_text(self):
     DW = DataWarehouse()
     DW.save('test_2', "Open Mining", content_type='application/text')
     r = StrictRedis()
     self.assertEquals(r.get('test_2'), "Open Mining")
 def test_save_application_json(self):
     DW = DataWarehouse()
     DW.save('test_1', {"id": 1, "name": "Open Mining"})
     r = StrictRedis()
     self.assertEquals(r.get('test_1'), '{"id": 1, "name": "Open Mining"}')