Commit 72bbfe67 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Added code to handle target as list + removed 'deleteTmpDataNode()' method.

parent 1cb8e282
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -659,27 +659,6 @@ class DbConnector(object):
                if not conn.closed:
                    conn.rollback()

    def deleteTmpDataNode(self, vospacePath):
        """Deletes a temporary VOSpace data node."""
        with self.getConnection() as conn:
            try:
                cursor = conn.cursor(cursor_factory = RealDictCursor)
                cursor.execute("""
                    WITH deleted AS (
                    DELETE FROM list_of_files 
                    WHERE list_node_id = id_from_vos_path(%s)
                     RETURNING list_node_id
                    ) DELETE FROM node 
                      WHERE node_id = 
                      (SELECT DISTINCT(list_node_id) 
                       FROM deleted);
                    """,
                    (vospacePath,))
                conn.commit()
            except Exception as e:
                if not conn.closed:
                    conn.rollback()

    def setAsyncTrans(self, nodeVOSPath, value):
        """Sets the 'async_trans' flag for a VOSpace node."""
        with self.getConnection() as conn:
+0 −4
Original line number Diff line number Diff line
@@ -264,10 +264,6 @@ class RetrieveExecutor(TaskExecutor):
        """
        Cleanup method.
        """
        nodeType = self.jobObj.jobInfo["transfer"]["protocols"][0]["param"][0]["value"]
        vospacePath = self.jobObj.jobInfo["transfer"]["target"].split("!vospace")[1]
        if nodeType == "list":
            self.dbConn.deleteTmpDataNode(vospacePath)
        self.fileList.clear()
        self.nodeList.clear()
        self.storageType = None
+4 −12
Original line number Diff line number Diff line
@@ -40,18 +40,10 @@ class RetrievePreprocessor(TaskExecutor):
        super(RetrievePreprocessor, self).__init__()

    def execute(self):
        nodeType = self.jobObj.jobInfo["transfer"]["protocols"][0]["param"][0]["value"]
        vospacePath = self.jobObj.jobInfo["transfer"]["target"].split("!vospace")[1]
        if nodeType == "single":
            self.nodeList.append(vospacePath)
        else:
            self.nodeList = self.dbConn.getVOSpacePathList(vospacePath)
        self.jobObj.jobInfo["nodeList"] = self.nodeList
        if os.path.exists("nl.txt"):
            os.remove("nl.txt")
        nl = open("nl.txt", 'w')
        nl.write(json.dumps(self.nodeList, indent = 4))
        nl.close()
        vospacePathList = self.jobObj.jobInfo["transfer"]["target"]
        for vospacePath in vospacePathList:
            self.nodeList.append(vospacePath.split("!vospace")[1])
        self.jobObj.jobInfo["nodeList"] = self.nodeList.copy()

    def cleanup(self):
        self.nodeList.clear()