Commit 1885c8c5 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Added 'execute()' method + fixed missing connection to database.

parent c459d78b
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -13,9 +13,18 @@ class RetrievePreprocessor(TaskExecutor):
                                  self.params["host"],
                                  self.params.getint("port"),
                                  self.params["db"])
        self.jobObj = None
        self.nodeList = []
        super(RetrievePreprocessor, self).__init__()
        
    def execute(self):
        vospacePath = self.jobObj.jobInfo["transfer"]["target"].split("!vospace")[1]
        self.dbConn.connect()
        osPath = self.dbConn.getOSPath(vospacePath)
        self.dbConn.disconnect()
        self.nodeList.append(osPath)
        self.jobObj.jobInfo["transfer"]["nodeList"] = self.nodeList

    def run(self):
        print("Starting retrieve preprocessor...")
        self.setSourceQueueName("read_pending")
@@ -24,10 +33,7 @@ class RetrievePreprocessor(TaskExecutor):
            self.wait()
            if self.destQueue.len() < self.maxReadyJobs and self.srcQueue.len() > 0:
                self.jobObj = self.srcQueue.getJob()
                vospacePath = self.jobObj.jobInfo["transfer"]["target"].split("!vospace")[1]
                osPath = dbConn.getOSPath(vospacePath)
                self.nodeList.append(osPath)
                self.jobObj.jobInfo["transfer"]["nodeList"] = self.nodeList
                self.execute()     
                self.srcQueue.extractJob()
                self.destQueue.insertJob(self.jobObj)
                print(f"Job {self.jobObj.jobId} MOVED from {self.srcQueue.name()} to {self.destQueue.name()}")
 No newline at end of file