Commit 0016ee11 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Minor changes.

parent 4db08d7d
Loading
Loading
Loading
Loading
+9 −17
Original line number Diff line number Diff line
@@ -32,11 +32,8 @@ class StorePreprocessor(Preprocessor):
                                  self.params["host"], 
                                  self.params.getint("port"), 
                                  self.params["db"])
        self.storageBasePaths = dict()
        self.params = config.loadSection("tape_library")
        self.storageBasePaths["tape"] = self.params["base_path"]
        self.params = config.loadSection("ia2_server")
        self.storageBasePaths["server"] = self.params["base_path"]
        self.params = config.loadSection("transfer_node")
        self.storageBasePath = self.params["base_path"]        
        self.jobObj = None        
        self.dbConn.connect()
        super(StorePreprocessor, self).__init__()
@@ -137,12 +134,9 @@ class StorePreprocessor(Preprocessor):
        out = open("log.txt", "w")
        for dir in dirs:
            out.write(f"DIR: {dir}\n")
            if self.jobObj["jobInfo"]["requestType"] == "HSTORE":
                pathPrefix = self.storageBasePaths["tape"].replace("{username}", self.jobObj["jobInfo"]["userName"])
            elif self.jobObj["jobInfo"]["requestType"] == "CSTORE":
                pathPrefix = self.storageBasePaths["server"].replace("{username}", self.jobObj["jobInfo"]["userName"])
            pathPrefix = self.storageBasePath.replace("{username}", self.username)
            out.write(f"pathPrefix: {pathPrefix}\n")
            basePath = os.path.dirname(dir).replace(pathPrefix, "/" + self.jobObj["jobInfo"]["userName"])
            basePath = os.path.dirname(dir).replace(pathPrefix, "/" + self.username)
            out.write(f"basePath: {basePath}\n")
            cnode = Node(os.path.basename(dir), "container");            
            cnode.setParentPath(basePath)
@@ -154,12 +148,9 @@ class StorePreprocessor(Preprocessor):
            for file in flist:
                out.write(f"FILE: {file}\n")
                if self.md5calc.fileIsValid(file):                    
                    if self.jobObj["jobInfo"]["requestType"] == "HSTORE":
                        pathPrefix = self.storageBasePaths["tape"].replace("{username}", self.jobObj["jobInfo"]["userName"])
                    elif self.jobObj["jobInfo"]["requestType"] == "CSTORE":
                        pathPrefix = self.storageBasePaths["server"].replace("{username}", self.jobObj["jobInfo"]["userName"])            
                    pathPrefix = self.storageBasePath.replace("{username}", self.username)            
                    out.write(f"pathPrefix: {pathPrefix}\n")
                    basePath = os.path.dirname(file).replace(pathPrefix, "/" + self.jobObj["jobInfo"]["userName"])
                    basePath = os.path.dirname(file).replace(pathPrefix, "/" + self.username)
                    out.write(f"basePath: {basePath}\n")
                    dnode = Node(os.path.basename(file), "data")
                    dnode.setParentPath(basePath)
@@ -175,7 +166,8 @@ class StorePreprocessor(Preprocessor):
        while True:
            if(self.readyQueue.len() <= self.maxReadyJobs and self.pendingQueue.len() > 0):
                self.jobObj = self.pendingQueue.getJob()
                self.prepare(self.jobObj["jobInfo"]["userName"])
                self.username = self.jobObj["jobInfo"]["userName"]
                self.prepare(self.username)
                self.execute()
                self.pendingQueue.moveJobTo("ready")
                print("Job MOVED!")