Loading transfer_service/db_connector.py +22 −3 Original line number Diff line number Diff line Loading @@ -65,7 +65,12 @@ class DbConnector(object): if self.conn: out = open("db_connector_log.txt", "a") #print(f"parentOSPath: {node.parentPath}") self.cursor.execute("SELECT path FROM node n JOIN node_os_path o ON n.node_id = o.node_id WHERE os_path = %s;", (node.parentPath,)) self.cursor.execute(""" SELECT path FROM node n JOIN node_os_path o ON n.node_id = o.node_id WHERE os_path = %s; """, (node.parentPath,)) result = self.cursor.fetchall() for i in result: out.write(f"queryResult: {i}\n") Loading Loading @@ -100,8 +105,22 @@ class DbConnector(object): (value, nodeOSPath,)) self.conn.commit() def selectNode(self): pass def getOSPath(self, vospacePath, pathPrefix): if self.conn: self.cursor.execute(""" SELECT os_path, tstamp_wrapper_dir FROM node_path np JOIN node n ON np.node_id = n.node_id WHERE vos_path = %s; """, (vospacePath,)) result = self.cursor.fetchall() nodeOSPath = result[0]["os_path"] tstampWrappedDir = result[0]["tstamp_wrapper_dir"] pathElementList = nodeOSPath.split('/') pathElementList.insert(2, tstampWrappedDir) osPath = '/' + '/'.join(filter(None, pathElementList)) return osPath def getJob(self, jobId): if self.conn: Loading Loading
transfer_service/db_connector.py +22 −3 Original line number Diff line number Diff line Loading @@ -65,7 +65,12 @@ class DbConnector(object): if self.conn: out = open("db_connector_log.txt", "a") #print(f"parentOSPath: {node.parentPath}") self.cursor.execute("SELECT path FROM node n JOIN node_os_path o ON n.node_id = o.node_id WHERE os_path = %s;", (node.parentPath,)) self.cursor.execute(""" SELECT path FROM node n JOIN node_os_path o ON n.node_id = o.node_id WHERE os_path = %s; """, (node.parentPath,)) result = self.cursor.fetchall() for i in result: out.write(f"queryResult: {i}\n") Loading Loading @@ -100,8 +105,22 @@ class DbConnector(object): (value, nodeOSPath,)) self.conn.commit() def selectNode(self): pass def getOSPath(self, vospacePath, pathPrefix): if self.conn: self.cursor.execute(""" SELECT os_path, tstamp_wrapper_dir FROM node_path np JOIN node n ON np.node_id = n.node_id WHERE vos_path = %s; """, (vospacePath,)) result = self.cursor.fetchall() nodeOSPath = result[0]["os_path"] tstampWrappedDir = result[0]["tstamp_wrapper_dir"] pathElementList = nodeOSPath.split('/') pathElementList.insert(2, tstampWrappedDir) osPath = '/' + '/'.join(filter(None, pathElementList)) return osPath def getJob(self, jobId): if self.conn: Loading