Commit 99aef238 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Moved database connect method in the right position + added output for debugging.

parent ee6ff7ee
Loading
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ class StorePreprocessor(Preprocessor):
        self.jobObj = None
        self.username = None
        self.userId = None
        self.dbConn.connect()
        super(StorePreprocessor, self).__init__()

    # Scan is performed only on the first level!
@@ -133,11 +132,14 @@ class StorePreprocessor(Preprocessor):
        [ dirs, files ] = self.scanRecursive()
        
        # File catalog update
        out = open("log.txt", "w")
        out = open("store_preprocessor_log.txt", "a")
        self.dbConn.connect()
        self.userId = self.dbConn.getRapId(self.username)
        out.write(f"USER: {self.username}\n")
        out.write(f"USER_ID: {self.userId}\n")
        pathPrefix = self.storageBasePath.replace("{username}", self.username)
        for dir in dirs:
            out.write(f"DIR: {dir}\n")            
            pathPrefix = self.storageBasePath.replace("{username}", self.username)
            out.write(f"pathPrefix: {pathPrefix}\n")
            basePath = os.path.dirname(dir).replace(pathPrefix, "/" + self.username)
            out.write(f"basePath: {basePath}\n")
@@ -151,7 +153,6 @@ class StorePreprocessor(Preprocessor):
            for file in flist:
                out.write(f"FILE: {file}\n")
                if self.md5calc.fileIsValid(file):                    
                    pathPrefix = self.storageBasePath.replace("{username}", self.username)            
                    out.write(f"pathPrefix: {pathPrefix}\n")
                    basePath = os.path.dirname(file).replace(pathPrefix, "/" + self.username)
                    out.write(f"basePath: {basePath}\n")
@@ -162,6 +163,7 @@ class StorePreprocessor(Preprocessor):
                    dnode.setContentMD5(self.md5calc.getMD5(file))                
                    self.dbConn.insertNode(dnode, dnode.parentPath)

        out.write("\n")
        out.close()
        self.dbConn.disconnect()