示例#1
0
文件: crawler.py 项目: 0B5C/Arachne
 def __init__(self):
     self.index = indexer.indexer()
     self.database = db_communication.db_com()
     self.base_dir = ""
     self.store_me = dict()
     self.documentCount = 0 # Count the documents you crawled
     self.chunk = chunksys.chunksys()
     self.chunkstore = list()
示例#2
0
 def __init__(self):
     self.index = indexer.indexer()
     self.database = db_communication.db_com()
     self.base_dir = ""
     self.store_me = dict()
     self.documentCount = 0  # Count the documents you crawled
     self.chunk = chunksys.chunksys()
     self.chunkstore = list()
示例#3
0
文件: chunksys.py 项目: 0B5C/Arachne
    def storagePersistor(self, chunks):
        # TODO: Create db_connection multiset for local use
        try:
            if len(chunks) > 3:
                db = db_communication.db_com()
                for item in chunks:
                    db.localMultiset(item)
                return 0

        except Exception as msg:
            # TODO: Exceptionhandler
            print str(msg)
            return -1
示例#4
0
    def storagePersistor(self, chunks):
        # TODO: Create db_connection multiset for local use
        try:
            if len(chunks) > 3:
                db = db_communication.db_com()
                for item in chunks:
                    db.localMultiset(item)
                return 0

        except Exception as msg:
            # TODO: Exceptionhandler
            print str(msg)
            return -1
示例#5
0
文件: chunksys.py 项目: 0B5C/Arachne
    def transfer(self, chunkstorage):
        try:
            db = db_communication.db_com()
            # push self.chunks to cassandra
            for item in chunkstorage:
                res = db.multi_set_words(item)
            if res == -1:
                print "Error, could not push to cassandra."
                if res == -1:
                    print "[FAILED] - Chunks were not pushed to cassandra."
                return -1
            return 0

        except Exception as msg:
            print str(msg)
示例#6
0
    def transfer(self, chunkstorage):
        try:
            db = db_communication.db_com()
            # push self.chunks to cassandra
            for item in chunkstorage:
                res = db.multi_set_words(item)
            if res == -1:
                print "Error, could not push to cassandra."
                if res == -1:
                    print "[FAILED] - Chunks were not pushed to cassandra."
                return -1
            return 0

        except Exception as msg:
            print str(msg)